# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
822891 | 2023-08-12T04:58:48 Z | mindiyak | Toy Train (IOI17_train) | C++14 | 7 ms | 996 KB |
#include "train.h" using namespace std; std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) { int n=a.size(); vector<vector<int>> paths(n,vector<int> ()); for (int i = 0; i < u.size(); i++){ paths[u[i]].push_back(v[i]); } vector<int> ans(n,-1); if(r[n-1] == 0)ans[n-1]=0; for(int i=n-2;i>=0;i--){ int win = 1; for(int j:paths[i]){ if(j==i){ if(r[i] != 1){ win = (a[i]==1) ? (win|0) : (win&0); if(paths.size()==1){ win = 0; } } }else if(j==i+1){ win = (a[i]==1) ? (win|ans[i+1]) : (win&ans[i+1]); if(paths.size()==1){ win = 0; } } } ans[i] = win; } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 724 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 | 1 ms | 244 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 | 5 ms | 996 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 | 5 ms | 896 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 | Incorrect | 7 ms | 980 KB | 3rd lines differ - on the 2nd token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 724 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |