# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
425690 | 2021-06-13T10:12:10 Z | MOUF_MAHMALAT | Toy Train (IOI17_train) | C++14 | 2000 ms | 1100 KB |
#include "train.h" #include<bits/stdc++.h> using namespace std; typedef int ll; vector<vector<ll> >v; ll n; bool b[5009],c[5009],is[5009]; bool dfs(ll d,ll op) { if(c[d]) op=n; if(op==0) return 0; if(is[d]) return 1; is[d]=1; bool r=b[d]^1; for(auto z:v[d]) { if(b[d]) r|=dfs(z,op-1); else r&=dfs(z,op-1); } is[d]=0; return r; } vector<int> who_wins(vector<int> A, vector<int> R, vector<int> from, vector<int> to) { n=A.size(); v.resize(n); for(ll i=0; i<to.size(); i++) v[from[i]].push_back(to[i]); for(ll i=0; i<n; i++) b[i]=A[i],c[i]=R[i]; vector<ll>ans; for(ll i=0; i<n; i++) ans.push_back(dfs(i,n)); return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 367 ms | 1088 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 | 204 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 | Execution timed out | 2077 ms | 992 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2093 ms | 1012 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Execution timed out | 2088 ms | 1100 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 367 ms | 1088 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |