| # | Problem | Pass Rate (passed user / total user) |
|---|---|---|
| 12469 | Big enough |
|
| 12521 | Break my heart |
|
| 12535 | So beautiful |
|
| 12558 | I2P(II) Chen_cpp_cheatsheet |
|
| 12825 | knuckle's name |
|
| 13078 | I2P(II) Chen Midterm 2 Rules |
|
Description
"AHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!"
~by anonymous singer
This problem is partial judge.
You need to deal with something "big enough".
Each input will contain two big integer a, b which are up to 5000 digits.
You need to calculate a+b and a-b.
The input will end by EOF.
Input
a and b is both up to 5000 digits and separated by a blank
The input will end by EOF
Output
For each input print the result of a+b and a-b.
Each result is end by a \n
Sample Input Download
Sample Output Download
Partial Judge Code
12469.cppPartial Judge Header
12469.hTags
Discuss
Description
I have broken many girls' hearts into pieces. But none of them mad at me. None.
~ by anonymous surgeon
You're a surgeon, you need to mend those girls' hearts. Therefore you need a data structure to support some functions.
This question is about maintain a set that contains only integers.
There will be n instructions.
Each instruction will be either:
insert:
Insert a new element ai into the set. Note that if the element has already in the set, do nothing.
print:
print all the element in the set in increasing order.
min:
print the number in the set that is the smallest. If there's no number, do nothing.
range_erase:
You will have two integer l, r.
You need to erase all the elements ai in the set that l <= ai <= r
Hint: You can solve this question very fast by using std::set .
These are some functions you may use in your code:
set.begin(), set.size(), set.erase(), set.lower_bound(), set.upper_bound(), set.insert(). To traverse through your set, you may also need iterator or type auto(only in c++11!)
You can also solve this question in C.

Input
the input will contain several lines.
The first line only contains an integer n (1 <= n <= 5000)
The following are n lines.
Each lines contains a instruction list above.
Note that ai (0 <= ai <= 10^9)
Output
For each print instruction, print all the number in the set in increasing order.
Each number is separated by a single blank.(No blank at the the end!)
Remember to print \n at the end of output
For each min instruction, print the smallest number in the set.
Remember to print \n at the end of output
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Into the unknown~ ~ ~ ~
~ by anonymous queen
As a programmer, you know that into the unknown will cause your program fatal error. Although you despise the unknown behavior, you still like this song. You decide to study how lyric work.
Give you n words. Each word contains at least one vowel( 'a', 'e', 'i', 'o', 'u' ) and only contains lower case character.
Every four words can compose a lyric in two lines form.
Each line only contains two words and separated by a single blank.
A lyric is good if and only if:
-
the first line's first word contains as many vowels as the second line's first word
-
the first line's second word contains as many vowels as the second line's second word.
-
the last vowel of first line's second word is same as the last vowel of second line's second word
EXAMPLE:
about proud
hooray round
This example is a good lyric.
Because "about" has 3 vowels so is "hooray",
"proud" has 2 vowels so is "round"
and the last vowel of "proud" is "u" so is "round".
Your task is finding how many good lyric can be composed from the n words.
Make the answer as big as possible.
Note: Each word can be only used for one time!

Download the C++ reference.
You will see the file named "12534.cpp" but that's OK.
Just download the file and change the filename extension(副檔名) into "zip" then you can upzip the file and use the reference.
The link is below.
Input
The first line contains only one integer n(1 <= n <= 100000)
The following n lines each lines contain only one string.
Each string's length will not exceed 200.
Output
Print the largest number of lyric that you can compose from n words.
Remember to print \n at the end of output.
Sample I/O explain:
14
wow
this
is
the
first
mcdics
codeforces
round
hooray
i
am
proud
about
that
You can compose at most three lyric:
about proud
hooray round
wow first
this is
i that
mcdics am
Sample Input Download
Sample Output Download
Tags
Discuss
Description
I/O optimization
If you encounter a TLE, you may try to use this optimization for C++ I/O functions:
std::ios_base::sync_with_stdio(false);
cin.tie(0);
And replace all std::endl with '\n'.
Do note that you must not use any of C I/O functions such as scanf, printf, fgets if you use this optimization.
<vector>
#include <iostream>
#include <vector>
#include <algorithm> // sort
int main () {
std::vector<int> V;
int x;
while (std::cin >> x) {
V.push_back(x);
}
for (auto t : V) std::cout << " " << t;
std::cout << "\n";
std::sort(V.begin(), V.end());
for (auto t : V) std::cout<<" "<< t;
std::cout << "\n";
}
<queue>
#include <iostream>
#include <algorithm>
#include <queue>
#include <string>
using namespace std;
int main() {
string s;
queue<string> q;
while (cin >> s) {
if (s == "Push") {
cin >> s;
q.push(s);
}
else if (s == "Pop") {
if (q.size()>0)
q.pop();
}
else if (s == "Front") {
if (q.size() == 0)
cout << "empty\n";
else
cout << q.front() << "\n";
}
}
}
<stringstream>
#include <string>
#include <iostream>
#include <sstream> // std::stringstream
int main () {
std::stringstream ss;
ss << "Hello " << 123;
std::string s = ss.str();
std::cout << s << '\n';
}
<set>
#include <iostream>
#include <set>
int main()
{
std::set<int> S = {1, 2, 3, 4};
auto search = S.find(2);
if(search != S.end()) {
std::cout << (*search) << '\n';
}
else {
std::cout << "Not found\n";
}
}
<stack>
#include <stack>
#include <iostream>
int main()
{
std::stack<int> s;
s.push( 3 ); s.push( 6 );
s.push( 18 );
std::cout<<s.size()<<" elements\n";
std::cout<<"Top: "<< s.top()<< "\n";
s.pop();
std::cout<<s.size()<<" elements\n";
}
getline()
#include <string>
#include <iostream>
int main()
{
std::string name;
std::cout << "What is your name? ";
std::getline(std::cin, name);
std::cout << "Hello "<< name<< "\n";
}
<map>
#include <iostream>
#include <string>
#include <map>
#include <utility> // make_pair
int main()
{
std::map<std::string, int> ID;
ID.insert(std::make_pair("Tom", 123));
std::cout << ID["Tom"] << "\n";
}
<string>
#include <iostream>
#include <string>
int main() {
std::string str1, str2, out;
while (std::cin >> str1 >> str2) {
out.clear();
for(auto t : str1) out.push_back(t);
std::cout << out << '\n';
out += str2;
std::cout << out << '\n';
out.pop_back();
std::cout << out << '\n';
for(size_t i = 0; i < out.size(); i++)
std::cout << out[i];
std::cout << '\n';
}
}
Miscellaneous
For more standard library or C++ reference, please refer to this file and rename the downloaded file(12534.cpp) to reference.zip, then unzip it. There's a readme inside the zip.
If you have difficulty renaming file, try the following command on terminal (Windows)
move 12534.cpp reference.zip
Input
Output
Sample Input Download
Sample Output Download
Tags
Discuss
Description
Do you know de way?
by uganda knuckles
Knuckles are magical animals and I don't know how to descripe such non-sense
google it yourself :)
Two string belongs to same group if :
-
there exists a character that exist in both string.
-
there exists a character in both string A and B,
and there exists another character in both string B and C,
then A, B, C belong to same group.
Now, given n strings, you need to answer how many groups are there?
A group can have members from 1 to n.
Example:
Given n=4
strings are "a", "b", "ab", "d".
"a" and "ab" and "b" belong to same group.
"d" form a group by it self.
Therefore there are 2 groups.

Hint:
Your first thought might be that if there exist a character in both string you can create an edge between both string .
Then you can use DFS to find out how many connected components(連通塊) are in the graph.
It's similar to 12155 - Cat-Toast Crisis .
But in this problem, this way will cause TLE.
You need to change the way you construct the graph,
you can't just easily connect two string, think another way (:

Input
First line contains only one integer t( 1<= t <= 30) which means the number of testcases.
In each testcase:
First line contains one integer n( 1 <= n <= 2000 ).
And the following n lines, each line contains one string( 1 <= length of string <= 1000 )
Output
For each testcase output the number of groups.
Remember to print '\n' at the end of each output.
Sample Input Download
Sample Output Download
Tags
Discuss
Description
-
Both C and C++ are allowed. Solving problems with other languages (e.g. python, java) are forbidden, otherwise you'll get zero point.
-
Paper references, electronic devices, or other items that may contain any information relative to this exam are not allowed.
-
Before leaving, please tell TAs and sign your name as a record and leave.
-
The score of each problem is shown below:
-
12521:
(4, 1) points -
12469:
(6, 3) points -
12535:
(6, 3) points -
12825:
(8, 0) points
Your score will be sum of the first score of one problem you submitted and the second score of another problem you submitted.
For example, if you get accepted at problem 12521 and 12825, your score will be max(4+0, 8+1)=9.
However, answering multiple problems will not increase your score. We will only pick the two problems with highest possible score.
-
If you get partially correct in a problem, your score of the problem will be
-
score of the problem*number of testcases you passed/number of testcases
For example, if score of a problem is 10, which contains 6 testcases, and you pass the 3 testcases, you'll get 10*3/6=5 points on this problem.