# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1037591 | 2024-07-29T05:24:12 Z | 12345678 | 장난감 기차 (IOI17_train) | C++17 | 17 ms | 1544 KB |
#include "train.h" #include <bits/stdc++.h> using namespace std; const int nx=5e3+5; int n, cy[nx], pa[nx], vs[nx], f; vector<int> d[nx], rv[nx]; void dfs(int u, int rt) { vs[u]=1; if (f) return; for (auto v:d[u]) { if (!f&&v==rt) { int tmp=u; while (tmp!=rt) cy[tmp]=1, tmp=pa[tmp]; cy[rt]=1; f=1; return; } if (vs[v]) continue; pa[v]=u; dfs(v, rt); } } std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) { n=a.size(); for (int i=0; i<u.size(); i++) d[u[i]].push_back(v[i]), rv[v[i]].push_back(u[i]); for (int i=0; i<n; i++) { if (r[i]) { f=0; for (int j=0; j<n;j ++) vs[j]=1; dfs(i, i); } } vector<int> res(n); queue<int> q; for (int i=0; i<n;i ++) vs[i]=0; for (int i=0; i<n;i ++) if (cy[i]) q.push(i), vs[i]=1; while (!q.empty()) { auto cur=q.front(); q.pop(); res[cur]=1; for (auto x:rv[cur]) if (!vs[x]) vs[x]=1,q.push(x); } return res; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 11 ms | 1112 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 600 KB | 3rd lines differ - on the 2nd token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 1372 KB | Output is correct |
2 | Correct | 5 ms | 1372 KB | Output is correct |
3 | Correct | 6 ms | 1544 KB | Output is correct |
4 | Incorrect | 7 ms | 1388 KB | 3rd lines differ - on the 1st token, expected: '1', found: '0' |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 17 ms | 1348 KB | 3rd lines differ - on the 696th token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 1372 KB | 3rd lines differ - on the 1st token, expected: '1', found: '0' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 11 ms | 1112 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |