# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
775970 | 2023-07-07T07:54:14 Z | PoonYaPat | 장난감 기차 (IOI17_train) | C++14 | 1188 ms | 1524 KB |
#include "train.h" #include <bits/stdc++.h> using namespace std; int n; bool c[5005],charge[5005],vis[5005]; vector<int> adj[5005],radj[5005],ans; void dfs(int x) { for (auto s : adj[x]) { if (!vis[s]) { vis[s]=true; dfs(s); } } } void rdfs(int x) { vis[x]=true; ans[x]=1; for (auto s : radj[x]) { if (!vis[s]) { rdfs(s); } } } 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<n; ++i) charge[i]=r[i], c[i]=a[i], ans.push_back(0); for (int i=0; i<u.size(); ++i) { adj[u[i]].push_back(v[i]); radj[v[i]].push_back(u[i]); } for (int i=0; i<n; ++i) { if (!charge[i]) continue; memset(vis,0,sizeof(vis)); dfs(i); if (!vis[i]) continue; memset(vis,0,sizeof(vis)); rdfs(i); } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 105 ms | 1228 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 468 KB | 3rd lines differ - on the 8th token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 1364 KB | Output is correct |
2 | Correct | 17 ms | 1364 KB | Output is correct |
3 | Correct | 28 ms | 1460 KB | Output is correct |
4 | Correct | 408 ms | 1452 KB | Output is correct |
5 | Correct | 49 ms | 1464 KB | Output is correct |
6 | Correct | 52 ms | 1364 KB | Output is correct |
7 | Correct | 384 ms | 1364 KB | Output is correct |
8 | Correct | 6 ms | 1372 KB | Output is correct |
9 | Correct | 5 ms | 1364 KB | Output is correct |
10 | Correct | 8 ms | 1364 KB | Output is correct |
11 | Correct | 6 ms | 1236 KB | Output is correct |
12 | Correct | 5 ms | 1236 KB | Output is correct |
13 | Correct | 6 ms | 1492 KB | Output is correct |
14 | Correct | 6 ms | 1492 KB | Output is correct |
15 | Correct | 6 ms | 1492 KB | Output is correct |
16 | Correct | 8 ms | 1492 KB | Output is correct |
17 | Correct | 6 ms | 1492 KB | Output is correct |
18 | Correct | 92 ms | 1180 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 1188 ms | 1276 KB | 3rd lines differ - on the 696th token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 7 ms | 1524 KB | 3rd lines differ - on the 2nd token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 105 ms | 1228 KB | 3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 | Halted | 0 ms | 0 KB | - |