# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
33549 | 2017-10-29T17:32:53 Z | mohammad_kilani | Toy Train (IOI17_train) | C++14 | 6 ms | 15124 KB |
#include <bits/stdc++.h> #include "train.h" using namespace std; const int N = 5010; int n ; bitset< N > dp[N][2] , vis[N][2]; vector<int> g[N] , a , r; bool solve(int i, int j,bool b){ if(r[i]) j = n; if(j == 0) return 0; if(vis[i][j][b]) return dp[i][j][b]; vis[i][j][b] = 1; dp[i][j][b] = (b ^ 1); bool can = false; if(!a[i]){ can = true; for(int k=0;k<g[i].size();k++){ int node = g[i][k]; if(solve(node,j-1,a[i] & 1) == 0) can = 0; } } else{ for(int k=0;k<g[i].size();k++){ int node = g[i][k]; if(solve(node,j-1,a[i] & 1) == 1) can = 1; } } return dp[i][j][b] = can; } std::vector<int> who_wins(std::vector<int> A, std::vector<int> R, std::vector<int> u, std::vector<int> v) { vector<int> ans; a = A; r = R;; n = a.size(); for(int i=0;i<u.size();i++) g[u[i]].push_back(v[i]); for(int i=0;i<n;i++){ ans.push_back(solve(i,n,A[i] & 1)); } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 15020 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 14504 KB | 3rd lines differ - on the 2nd token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 6 ms | 15124 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 6 ms | 14984 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 6 ms | 15124 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 3 ms | 15020 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |