Task: | Coins |
Sender: | DualCore |
Submission time: | 2018-05-26 14:31:19 +0300 |
Language: | C++ |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.84 s | details |
#2 | TIME LIMIT EXCEEDED | -- | details |
#3 | TIME LIMIT EXCEEDED | -- | details |
#4 | ACCEPTED | 0.29 s | details |
#5 | WRONG ANSWER | 0.59 s | details |
Code
#include <iostream> #include <string> #include <vector> #include <set> int main() { std::string first_line; int n; std::getline(std::cin, first_line); n = std::stoi(first_line); std::set<int> left, right; for (int i = 0; i < n; ++i) { std::string line; std::getline(std::cin, line); std::size_t pos; int c = std::stoi(line, &pos); int s = std::stoi(line.substr(pos, line.length() - pos)); (s == 1) ? left.insert(c) : right.insert(c); bool left_are_greater = true; bool right_are_greater = true; if (left.size() == 0 && right.size() != 0) { std::cout << "<\n"; continue; } if (right.size() == 0 && left.size() != 0) { std::cout << ">\n"; continue; } if (left.size() == right.size()) { for (auto leftit = left.rbegin(), rightit = right.rbegin(); leftit != left.rend(); ++leftit, ++rightit) { if (*leftit > *rightit) right_are_greater = false; else left_are_greater = false; if (!(left_are_greater || right_are_greater)) break; } if (left_are_greater) std::cout << ">\n"; else if (right_are_greater) std::cout << "<\n"; else std::cout << "?\n"; } else if (left.size() > right.size()) { for (auto leftit = left.rbegin(), rightit = right.rbegin(); rightit != right.rend(); ++leftit, ++rightit) { if (*leftit > *rightit) right_are_greater = false; else left_are_greater = false; if (!(left_are_greater || right_are_greater)) break; } if (right_are_greater) std::cout << "?\n"; else std::cout << ">\n"; } else { for (auto leftit = left.rbegin(), rightit = right.rbegin(); leftit != left.rend(); ++leftit, ++rightit) { if (*leftit > *rightit) right_are_greater = false; else left_are_greater = false; if (!(left_are_greater || right_are_greater)) break; } if (left_are_greater) std::cout << "?\n"; else std::cout << "<\n"; } } }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
200000 175878 1 146174 1 4939 2 181388 1 ... |
correct output |
---|
> > > > > ... |
user output |
---|
> > > > > ... |
Test 2
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 1 2 2 1 3 2 4 1 ... |
correct output |
---|
< > < > < ... |
user output |
---|
(empty) |
Test 3
Verdict: TIME LIMIT EXCEEDED
input |
---|
200000 1 1 2 1 3 1 4 1 ... |
correct output |
---|
> > > > > ... |
user output |
---|
(empty) |
Test 4
Verdict: ACCEPTED
input |
---|
200000 1 1 2 1 3 1 4 1 ... |
correct output |
---|
> > > > > ... |
user output |
---|
> > > > > ... |
Test 5
Verdict: WRONG ANSWER
input |
---|
200000 188909 2 58944 1 26824 1 143263 2 ... |
correct output |
---|
< < ? < < ... |
user output |
---|
< < ? < < ... |