# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
33242 | 2017-10-23T04:35:48 Z | model_code | Toy Train (IOI17_train) | C++11 | 6 ms | 2748 KB |
#include "train.h" #include <iostream> #include <vector> #include <cstring> #include <set> using namespace std; const int max_n = 5000; const bool A = true; const bool B = false; int n; vector <int> adj[max_n]; vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) { n = (int)a.size(); for (int i = 0; i < u.size(); i++) adj[u[i]].push_back(v[i]); vector <int> res(n, B); for (int i = n-1; i >= 0; i--) { bool self_loop = false, next = false; for (auto x : adj[i]) self_loop |= (x == i), next |= (x == i+1); if (self_loop && r[i] == true && a[i] == A) res[i] = A; else if (self_loop && r[i] == false && a[i] == B) res[i] = B; else if (next) res[i] = res[i + 1]; else res[i] = r[i]; } return res; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 2540 KB | Output is correct |
2 | Correct | 3 ms | 2540 KB | Output is correct |
3 | Correct | 3 ms | 2540 KB | Output is correct |
4 | Correct | 3 ms | 2540 KB | Output is correct |
5 | Correct | 0 ms | 2540 KB | Output is correct |
6 | Correct | 3 ms | 2540 KB | Output is correct |
7 | Correct | 3 ms | 2540 KB | Output is correct |
8 | Correct | 0 ms | 2540 KB | Output is correct |
9 | Correct | 3 ms | 2540 KB | Output is correct |
10 | Correct | 3 ms | 2540 KB | Output is correct |
11 | Correct | 3 ms | 2544 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 2136 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 2748 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 2616 KB | 3rd lines differ - on the 21st token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 2748 KB | 3rd lines differ - on the 1st token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 2540 KB | Output is correct |
2 | Correct | 3 ms | 2540 KB | Output is correct |
3 | Correct | 3 ms | 2540 KB | Output is correct |
4 | Correct | 3 ms | 2540 KB | Output is correct |
5 | Correct | 0 ms | 2540 KB | Output is correct |
6 | Correct | 3 ms | 2540 KB | Output is correct |
7 | Correct | 3 ms | 2540 KB | Output is correct |
8 | Correct | 0 ms | 2540 KB | Output is correct |
9 | Correct | 3 ms | 2540 KB | Output is correct |
10 | Correct | 3 ms | 2540 KB | Output is correct |
11 | Correct | 3 ms | 2544 KB | Output is correct |
12 | Incorrect | 0 ms | 2136 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
13 | Halted | 0 ms | 0 KB | - |