# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
33690 | 2017-10-31T17:50:48 Z | mohammad_kilani | Toy Train (IOI17_train) | C++14 | 1519 ms | 5996 KB |
#include <bits/stdc++.h> #include "train.h" using namespace std; const int N = 5010; bitset< N > win[N] ; vector<int> g[N]; std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) { vector<int> ans; int n = a.size(); for(int i=0;i<n;i++) win[i][0] = r[i]; for(int i=0;i<u.size();i++) g[u[i]].push_back(v[i]); for(int j=1;j<=n;j++){ for(int i=0;i<n;i++){ win[i][j] = a[i] ^ 1; for(int k=0;k<g[i].size();k++){ if(a[i]){ if(win[g[i][k]][j-1] || r[g[i][k]]) win[i][j] = 1; } else{ if(win[g[i][k]][j-1] == 0 && !r[g[i][k]]) win[i][j] = 0; } } } } for(int i=0;i<n;i++) ans.push_back(win[i][n]); return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 379 ms | 5632 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 | 0 ms | 5228 KB | 3rd lines differ - on the 8th token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 646 ms | 5996 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 | 499 ms | 5852 KB | 3rd lines differ - on the 696th token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1519 ms | 5976 KB | Output is correct |
2 | Correct | 603 ms | 5976 KB | Output is correct |
3 | Correct | 1156 ms | 5976 KB | Output is correct |
4 | Correct | 639 ms | 5812 KB | Output is correct |
5 | Correct | 0 ms | 5228 KB | Output is correct |
6 | Correct | 409 ms | 5632 KB | Output is correct |
7 | Correct | 59 ms | 5648 KB | Output is correct |
8 | Incorrect | 93 ms | 5672 KB | 3rd lines differ - on the 5th token, expected: '0', found: '1' |
9 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 379 ms | 5632 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |