# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
592784 |
2022-07-09T15:36:44 Z |
Richem |
Toy Train (IOI17_train) |
C++14 |
|
2000 ms |
262144 KB |
#include <iostream>
#include <vector>
using namespace std;
const int MAX_SOMMET = 5042;
int gagnant[MAX_SOMMET] = {0};
int nbSommet, nbArete;
bool adj[MAX_SOMMET][MAX_SOMMET] = {0};
bool qui[MAX_SOMMET] = {0};
bool recharge[MAX_SOMMET] = {0};
int dfs(int sommet) {
if(gagnant[sommet] != -1)
return gagnant[sommet];
for(int voisin = 0; voisin < MAX_SOMMET; voisin++) {
if(adj[sommet][voisin] == 0)
continue;
dfs(voisin);
gagnant[sommet] = gagnant[voisin];
}
return gagnant[sommet];
}
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
nbSommet = a.size();
nbArete = u.size();
for(int i = 0; i < nbSommet; i++) {
gagnant[i] = -1;
qui[i] = a[i];
recharge[i] = r[i];
}
for(int id = 0; id < nbArete; id++) {
if(u[id] == v[id]) {
if(a[u[id]] == 0) {
gagnant[u[id]] = 0;
}
if(a[u[id]] == 1 && r[u[id]] == 1) {
gagnant[u[id]] = 1;
}
}
else {
adj[u[id]][v[id]] = 1;
}
}
for(int sommet = 0; sommet < nbSommet; sommet++)
dfs(sommet);
vector<int> rep;
for(int i = 0; i < nbSommet; i++)
rep.push_back(gagnant[i]);
return rep;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
24 ms |
20564 KB |
3rd lines differ - on the 26th token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
114 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2079 ms |
72676 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2096 ms |
88348 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2087 ms |
90524 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
24 ms |
20564 KB |
3rd lines differ - on the 26th token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |