Code Submission Evaluation System Login

Datatähti 2016 alku

Start:2015-09-28 00:00:00
End:2015-10-12 00:00:00
 

Tasks | Scoreboard | Statistics


CSES - Datatähti 2016 alku - Results
History
2015-09-30 23:53:430
2015-09-30 14:08:35100
2015-09-30 14:08:0239
2015-09-30 14:06:3639
2015-09-29 18:17:58100
2015-09-29 18:17:33
2015-09-29 18:05:5739
2015-09-29 17:57:470
2015-09-29 17:51:210
Task:Osajono
Sender:viderizer
Submission time:2015-09-30 23:53:43
Language:C++
Status:READY
Score:0

Feedback

groupverdictscore
#1RUNTIME ERROR0
#2RUNTIME ERROR0
#3RUNTIME ERROR0

Test results

testverdicttime (s)group
#1RUNTIME ERROR0.14 / 1.001details
#2RUNTIME ERROR0.14 / 1.001details
#3RUNTIME ERROR0.12 / 1.001details
#4RUNTIME ERROR0.14 / 1.001details
#5RUNTIME ERROR0.14 / 1.001details
#6RUNTIME ERROR0.14 / 1.002details
#7RUNTIME ERROR0.15 / 1.002details
#8RUNTIME ERROR0.14 / 1.002details
#9RUNTIME ERROR0.14 / 1.002details
#10RUNTIME ERROR0.13 / 1.002details
#11RUNTIME ERROR0.14 / 1.003details
#12RUNTIME ERROR0.15 / 1.003details
#13RUNTIME ERROR0.15 / 1.003details
#14RUNTIME ERROR0.15 / 1.003details
#15RUNTIME ERROR0.15 / 1.003details

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) {
    // input
    int n;
    string n_s;
    string uolevi;
    string maija;

    getline(cin, n_s);
    n = stoi(n_s);
    getline(cin, uolevi);
    getline(cin, maija);

    // parsing input
    vector<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...
view   save

correct output
2554

view   save

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...
view   save

correct output
299

view   save

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...
view   save

correct output
4314

view   save

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...
view   save

correct output
4231

view   save

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...
view   save

correct output
5050

view   save

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...
view   save

correct output
6253029

view   save

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...
view   save

correct output
485173

view   save

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...
view   save

correct output
12427725

view   save

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...
view   save

correct output
12467549

view   save

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...
view   save

correct output
12502500

view   save

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...
view   save

correct output
2500051369

view   save

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...
view   save

correct output
192407124

view   save

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...
view   save

correct output
4998050400

view   save

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...
view   save

correct output
4998850144

view   save

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...
view   save

correct output
5000050000

view   save

user output
(empty)

Error:
terminate called after throwing an instance of 'std::invalid_argument'
  what():  stoi