# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
413039 | 2021-05-28T06:41:05 Z | 조영욱(#7624) | Toy Train (IOI17_train) | C++14 | 1352 ms | 1556 KB |
#include "train.h" #include <bits/stdc++.h> using namespace std; vector<int> adj[5000]; vector<int> gph[5000]; bool vis[5000]; int deg[5000]; bool chk[5000]; vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) { int n=a.size(); int m=u.size(); for(int i=0;i<m;i++) { gph[u[i]].push_back(v[i]); } vector<int> ret(n); for(int st=0;st<n;st++) { if (chk[st]) { continue; } queue<int> q; q.push(st); memset(vis,0,sizeof(vis)); vis[st]=true; while (!q.empty()) { int now=q.front(); q.pop(); for(int i=0;i<gph[now].size();i++) { int nt=gph[now][i]; if (vis[nt]) { continue; } vis[nt]=true; q.push(nt); } } for(int i=0;i<n;i++) { adj[i].clear(); } memset(deg,0,sizeof(deg)); for(int i=0;i<m;i++) { if (r[u[i]]==0&&r[v[i]]==0&&vis[u[i]]&&vis[v[i]]) { adj[u[i]].push_back(v[i]); deg[v[i]]++; } } for(int i=0;i<n;i++) { if (deg[i]==0) { q.push(i); } } int cnt=0; while (!q.empty()) { int now=q.front(); q.pop(); cnt++; for(int i=0;i<adj[now].size();i++) { int nt=adj[now][i]; deg[nt]--; if (deg[nt]==0) { q.push(nt); } } } for(int i=0;i<n;i++) { if (deg[i]!=0) { chk[i]=true; ret[i]=0; } } } return ret; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 740 ms | 972 KB | 3rd lines differ - on the 14th token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 460 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 | Correct | 996 ms | 1556 KB | Output is correct |
2 | Correct | 720 ms | 1412 KB | Output is correct |
3 | Correct | 434 ms | 1488 KB | Output is correct |
4 | Incorrect | 1295 ms | 1260 KB | 3rd lines differ - on the 1st token, expected: '1', found: '0' |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1352 ms | 1060 KB | 3rd lines differ - on the 1st token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 114 ms | 1356 KB | 3rd lines differ - on the 1st token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 740 ms | 972 KB | 3rd lines differ - on the 14th token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |