Task: | Osajono |
Sender: | viderizer |
Submission time: | 2015-09-30 23:53:43 +0300 |
Language: | C++ |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | RUNTIME ERROR | 0 |
#2 | RUNTIME ERROR | 0 |
#3 | RUNTIME ERROR | 0 |
test | verdict | time | group | |
---|---|---|---|---|
#1 | RUNTIME ERROR | 0.14 s | 1 | details |
#2 | RUNTIME ERROR | 0.14 s | 1 | details |
#3 | RUNTIME ERROR | 0.12 s | 1 | details |
#4 | RUNTIME ERROR | 0.14 s | 1 | details |
#5 | RUNTIME ERROR | 0.14 s | 1 | details |
#6 | RUNTIME ERROR | 0.14 s | 2 | details |
#7 | RUNTIME ERROR | 0.15 s | 2 | details |
#8 | RUNTIME ERROR | 0.14 s | 2 | details |
#9 | RUNTIME ERROR | 0.14 s | 2 | details |
#10 | RUNTIME ERROR | 0.13 s | 2 | details |
#11 | RUNTIME ERROR | 0.14 s | 3 | details |
#12 | RUNTIME ERROR | 0.15 s | 3 | details |
#13 | RUNTIME ERROR | 0.15 s | 3 | details |
#14 | RUNTIME ERROR | 0.15 s | 3 | details |
#15 | RUNTIME ERROR | 0.15 s | 3 | details |
Compiler report
input/code.cpp: In function 'int main(int, char**)': input/code.cpp:32:9: warning: variable 'n' set but not used [-Wunused-but-set-variable] int n; ^
Code
#include <iostream>#include <string>#include <sstream>#include <vector>#include <tuple>#include <set>#include <algorithm>using std::string;using std::cin;using std::cout;using std::stoi;using std::tuple;using std::vector;using std::stringstream;using std::make_tuple;using std::tuple_element;using std::getline;using std::get;using std::find;void debug(vector<int> v) {for (vector<int>::iterator it = v.begin(); it != v.end(); ++it) {cout << *it << " ";}cout << "\n";}int main(int argc, char** argv) {// inputint n;string n_s;string uolevi;string maija;getline(cin, n_s);n = stoi(n_s);getline(cin, uolevi);getline(cin, maija);// parsing inputvector<tuple<int, int, int>> v;stringstream ss(uolevi);stringstream ss2(maija);string sub;string sub2;vector<int> unread;while (getline(ss, sub, ' ') && getline(ss2, sub2, ' ')) {int i = stoi(sub);int j = stoi(sub2);v.push_back(make_tuple(i, j, 0));if (find(unread.begin(), unread.end(), i) == unread.end()) {unread.insert(unread.begin(), i);}if (find(unread.begin(), unread.end(), j) == unread.end()) {unread.insert(unread.begin(), j);}}//for (vector<tuple<int, int, int>>::reverse_iterator it = v.rbegin(); it != v.rend(); ++it) {//}stringstream result_ss;for (vector<tuple<int, int, int>>::iterator it = v.begin(); it != v.end(); ++it) {for (vector<int>::iterator it2 = unread.begin(); it2 != unread.end(); ++it2) {if (*it2 != get<0>(*it) && *it2 != get<1>(*it)) {*it = make_tuple(get<0>(*it), get<1>(*it), *it2);unread.erase(it2);break;}}//if ((get<2>(*it) == 0) && (it + 2 == v.end())) {// return 1;//}//cout << "(" << get<0>(*it) << ", " << get<1>(*it) << ", " << get<2>(*it) << "), ";result_ss << get<2>(*it) << " ";}string result_s(result_ss.str());result_s.pop_back();cout << result_s << "\n";return 0;}
Test details
Test 1
Group: 1
Verdict: RUNTIME ERROR
input |
---|
BBBAABBBAAAABBAAAABAABAABBBBBB... |
correct output |
---|
2554 |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'std::invalid_argument' what(): stoi
Test 2
Group: 1
Verdict: RUNTIME ERROR
input |
---|
GDFVYWQCZAFGICSXOSWBZMGPDBSSVL... |
correct output |
---|
299 |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'std::invalid_argument' what(): stoi
Test 3
Group: 1
Verdict: RUNTIME ERROR
input |
---|
AAAAAAAAAAAAAAAAAAAAAAAAAZAAAA... |
correct output |
---|
4314 |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'std::invalid_argument' what(): stoi
Test 4
Group: 1
Verdict: RUNTIME ERROR
input |
---|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... |
correct output |
---|
4231 |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'std::invalid_argument' what(): stoi
Test 5
Group: 1
Verdict: RUNTIME ERROR
input |
---|
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ... |
correct output |
---|
5050 |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'std::invalid_argument' what(): stoi
Test 6
Group: 2
Verdict: RUNTIME ERROR
input |
---|
BBABABBBABBAABBABBABAABAAABABA... |
correct output |
---|
6253029 |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'std::invalid_argument' what(): stoi
Test 7
Group: 2
Verdict: RUNTIME ERROR
input |
---|
RBKJMLDVQMKHYKCNDIVVKOMFUXTFMG... |
correct output |
---|
485173 |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'std::invalid_argument' what(): stoi
Test 8
Group: 2
Verdict: RUNTIME ERROR
input |
---|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... |
correct output |
---|
12427725 |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'std::invalid_argument' what(): stoi
Test 9
Group: 2
Verdict: RUNTIME ERROR
input |
---|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... |
correct output |
---|
12467549 |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'std::invalid_argument' what(): stoi
Test 10
Group: 2
Verdict: RUNTIME ERROR
input |
---|
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ... |
correct output |
---|
12502500 |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'std::invalid_argument' what(): stoi
Test 11
Group: 3
Verdict: RUNTIME ERROR
input |
---|
BAAAAABABBABAABAABABABBBABBAAB... |
correct output |
---|
2500051369 |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'std::invalid_argument' what(): stoi
Test 12
Group: 3
Verdict: RUNTIME ERROR
input |
---|
ABBURXDRVXAYBPXXOQZNYHLWGUEEWR... |
correct output |
---|
192407124 |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'std::invalid_argument' what(): stoi
Test 13
Group: 3
Verdict: RUNTIME ERROR
input |
---|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... |
correct output |
---|
4998050400 |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'std::invalid_argument' what(): stoi
Test 14
Group: 3
Verdict: RUNTIME ERROR
input |
---|
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... |
correct output |
---|
4998850144 |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'std::invalid_argument' what(): stoi
Test 15
Group: 3
Verdict: RUNTIME ERROR
input |
---|
QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ... |
correct output |
---|
5000050000 |
user output |
---|
(empty) |
Error:
terminate called after throwing an instance of 'std::invalid_argument' what(): stoi