# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
422179 | 2021-06-09T20:23:39 Z | Antekb | Toy Train (IOI17_train) | C++14 | 12 ms | 1932 KB |
#include "train.h" #include<bits/stdc++.h> #define st first #define nd second #define pb(x) push_back(x) using namespace std; const int N=5005; vector<int> E[N], rE[N], E2[N], rE2[N]; int d[N]; int wsk=0; int czy[N][N], dobre[N], petla[N]; int vis[N]; int usun[N]; std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> uu, std::vector<int> vv) { int n=a.size(), m=uu.size(); std::vector<int> res(n); for(int i=0; i<m; i++){ //cout<<uu[i]<<" "<<vv[i]<<"\n"; E[uu[i]].pb(vv[i]); rE[vv[i]].pb(uu[i]); } //int wsk=n-1; while(true){ vector<int> V; for(int j=0; j<n; j++)if(!usun[j])d[j]=E[j].size(), vis[j]=0; for(int j=0; j<n; j++)if(r[j] || usun[j])V.pb(j), vis[j]=1; for(int j=0; j<V.size(); j++){ int v=V[j]; for(int u:rE[v]){ if(a[u] && !vis[u]){ vis[u]=1; V.pb(u); } if(!a[u] && --d[u]==0 && !vis[u]){ vis[u]=1; V.pb(u); } } } //for(int i:V)cout<<i<<" "; //cout<<" q\n"; if(V.size()==n)break; V.clear(); for(int j=0; j<n; j++){ if(!vis[j] || usun[j]){ vis[j]=1; V.pb(j); } else{ vis[j]=0; d[j]=E[j].size(); } } for(int j=0; j<V.size(); j++){ int v=V[j]; for(int u:rE[v]){ if(!a[u] && !vis[u]){ vis[u]=1; V.pb(u); } if(a[u] && --d[u]==0 && !vis[u]){ vis[u]=1; V.pb(u); } } } for(int i:V)usun[i]=1; //for(int i:V)cout<<i<<" "; //cout<<"\n"; } for(int i=0; i<n; i++)res[i]=!usun[i]; return res; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 1484 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 | Correct | 1 ms | 716 KB | Output is correct |
2 | Correct | 1 ms | 716 KB | Output is correct |
3 | Correct | 1 ms | 716 KB | Output is correct |
4 | Incorrect | 1 ms | 716 KB | 3rd lines differ - on the 4th token, expected: '0', found: '1' |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 8 ms | 1740 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 | Correct | 8 ms | 1508 KB | Output is correct |
2 | Correct | 9 ms | 1740 KB | Output is correct |
3 | Correct | 9 ms | 1868 KB | Output is correct |
4 | Correct | 10 ms | 1808 KB | Output is correct |
5 | Correct | 9 ms | 1804 KB | Output is correct |
6 | Correct | 10 ms | 1840 KB | Output is correct |
7 | Correct | 9 ms | 1880 KB | Output is correct |
8 | Correct | 10 ms | 1812 KB | Output is correct |
9 | Correct | 12 ms | 1724 KB | Output is correct |
10 | Correct | 9 ms | 1868 KB | Output is correct |
11 | Correct | 9 ms | 1808 KB | Output is correct |
12 | Correct | 9 ms | 1868 KB | Output is correct |
13 | Correct | 9 ms | 1888 KB | Output is correct |
14 | Correct | 11 ms | 1740 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 1612 KB | Output is correct |
2 | Correct | 9 ms | 1868 KB | Output is correct |
3 | Correct | 12 ms | 1932 KB | Output is correct |
4 | Correct | 9 ms | 1740 KB | Output is correct |
5 | Correct | 1 ms | 776 KB | Output is correct |
6 | Correct | 5 ms | 1356 KB | Output is correct |
7 | Correct | 7 ms | 1408 KB | Output is correct |
8 | Incorrect | 9 ms | 1456 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 | 6 ms | 1484 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |