# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
584681 |
2022-06-27T19:18:31 Z |
1ne |
Toy Train (IOI17_train) |
C++14 |
|
2000 ms |
1356 KB |
#include "train.h"
#include<bits/stdc++.h>
using namespace std;
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
int n = (int)a.size();
int m = (int)u.size();
vector<int>ans(n);
vector<vector<int>>adj(n);
for (int i = 0;i<m;++i){
adj[u[i]].push_back(v[i]);
}
vector<bool>visited(n,0);
vector<int>cnt(n,0);
vector<int>parent(n,-1);
for (int i = 0;i<n;++i){
function<int(int)>dfs = [&](int u){
if (visited[u]){
int x = u;
int got = 0;
while(parent[x]!=u && parent[x]!=-1){
got|=r[x];
x = parent[x];
}
x = parent[x];
if (x == u){
return (got | cnt[u]);
}
return cnt[u];
}
visited[u] = true;
int ans = 0;
for (auto x:adj[u]){
parent[x] = u;
ans|=dfs(x);
}
return cnt[u] = ans;
};
if (visited[i]){
ans[i] = cnt[i];
}
else{
ans[i] = dfs(i);
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
1236 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 |
Execution timed out |
2081 ms |
212 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
1356 KB |
Output is correct |
2 |
Correct |
10 ms |
1236 KB |
Output is correct |
3 |
Correct |
10 ms |
1236 KB |
Output is correct |
4 |
Execution timed out |
2093 ms |
980 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2079 ms |
832 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2088 ms |
980 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
1236 KB |
3rd lines differ - on the 14th token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |