# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
239001 |
2020-06-14T02:19:28 Z |
ChrisT |
Toy Train (IOI17_train) |
C++17 |
|
1033 ms |
1656 KB |
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
using pll = pair<ll,ll>;
using pli = pair<ll,int>;
using ld = long double;
#define all(x) (x).begin(),(x).end()
const int MN = 5e3 + 5, MM = 2e4 + 5, MOD = 1e9 + 7, BASE = 131;
vector<int> adj[MN]; int who[MN], charge[MN], toroot[MN]; bool found; bool vis[MN];
void dfs (int cur) {
vis[cur] = 1;
for (int i : adj[cur]) {
if (vis[i]) { //cycle
int cnt = toroot[cur] - toroot[i] + charge[i];
if (cnt) found = 1;
} else {
toroot[i] = toroot[cur] + charge[i];
dfs(i);
}
}
}
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
int n = a.size();
for (int i = 0; i < n; i++) who[i+1] = a[i], charge[i+1] = r[i];
for (int i = 0; i < (int)u.size(); i++) {
adj[u[i]+1].push_back(v[i]+1);
}
vector<int> ret;
for (int rt = 1; rt <= n; rt++) {
found = 0; toroot[rt] = charge[rt]; memset(vis,0,sizeof vis);
dfs(rt);
ret.push_back(found);
}
return ret;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
210 ms |
1144 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 |
5 ms |
384 KB |
3rd lines differ - on the 8th token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
158 ms |
1536 KB |
Output is correct |
2 |
Correct |
157 ms |
1528 KB |
Output is correct |
3 |
Correct |
150 ms |
1528 KB |
Output is correct |
4 |
Correct |
954 ms |
1616 KB |
Output is correct |
5 |
Incorrect |
772 ms |
1656 KB |
3rd lines differ - on the 11th token, expected: '0', found: '1' |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
775 ms |
1296 KB |
3rd lines differ - on the 696th token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1033 ms |
1536 KB |
3rd lines differ - on the 2nd token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
210 ms |
1144 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |