# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
584716 |
2022-06-27T21:44:48 Z |
1ne |
Toy Train (IOI17_train) |
C++14 |
|
26 ms |
1756 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,0);
vector<vector<int>>adj(n),adj2(n);
for (int i = 0;i<m;++i){
adj[u[i]].push_back(v[i]);
adj2[v[i]].push_back(u[i]);
}
vector<int>visited(n,0),visited2(n,0);
function<void(int)>dfs = [&](int u){
visited[u] = true;
for (auto x:adj[u]){
if (!visited[x])dfs(x);
}
};
function<void(int)>dfs2 = [&](int u){
visited2[u] = true;
for (auto x:adj2[u]){
if (!visited2[x])dfs2(x);
}
};
for (int i = 0;i<n;++i){
if (!r[i])continue;
for (int j = 0;j<n;++j){
visited[i] = false;
visited2[i] = false;
}
for (auto x:adj[i])dfs(x);
for (auto x:adj2[i])dfs2(x);
if (visited[i]){
for (int j = 0;j<n;++j){
ans[j] |=visited2[j];
}
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
17 ms |
1364 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 |
1 ms |
212 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 |
8 ms |
1756 KB |
Output is correct |
2 |
Correct |
10 ms |
1748 KB |
Output is correct |
3 |
Correct |
12 ms |
1736 KB |
Output is correct |
4 |
Correct |
13 ms |
1580 KB |
Output is correct |
5 |
Correct |
9 ms |
1492 KB |
Output is correct |
6 |
Incorrect |
9 ms |
1364 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
26 ms |
1236 KB |
3rd lines differ - on the 521st token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
7 ms |
1492 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 |
17 ms |
1364 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |