# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
584670 |
2022-06-27T18:53:20 Z |
1ne |
Toy Train (IOI17_train) |
C++14 |
|
142 ms |
262144 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,false);
vector<int>cnt(n,0);
function<int(int,int)>dfs = [&](int u,int got){
if (visited[u]){
if (got)return 1;
return 0;
}
int ans = 0;
for (auto x:adj[u]){
ans|=dfs(x,(got|(r[x] == 1)));
}
return cnt[u] = ans;
};
for (int i = 0;i<n;++i){
if (visited[i]){
ans[i] = cnt[i];
}
else{
ans[i] = dfs(i,r[i]);
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
142 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
132 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
132 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
138 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
136 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
142 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |