# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1054795 |
2024-08-12T12:11:03 Z |
Wansur |
Toy Train (IOI17_train) |
C++17 |
|
207 ms |
1736 KB |
#include <bits/stdc++.h>
#include "train.h"
#define ent '\n'
#define f first
#define s second
//#define int long long
using namespace std;
typedef long long ll;
const int maxn = 5e3 + 12;
const int mod = 1e9 + 7;
vector<int> g[maxn], rg[maxn];
int in[maxn], out[maxn];
bool won[maxn];
int n, m;
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> U, vector<int> V){
n = a.size(), m = U.size();
vector<int> ans(n);
for(int i=0;i<m;i++){
g[U[i]].push_back(V[i]);
rg[V[i]].push_back(U[i]);
}
for(int v=0;v<n;v++){
if(r[v] == 0){
continue;
}
for(int i=0;i<n;i++){
out[i] = g[i].size();
won[i] = 0;
}
won[v] = 1;
queue<int> q;
q.push(v);
while(q.size()){
int v = q.front();
q.pop();
for(int to:rg[v]){
if(a[to] && !won[to]){
won[to] = 1;
q.push(to);
}
if(!a[to]){
out[to]--;
if(out[to] == 0){
won[to] = 1;
q.push(to);
}
}
}
}
bool ok = 0;
for(int to:g[v]){
if(won[to]){
ok = 1;
}
}
if(ok){
for(int i=0;i<n;i++){
if(won[i]){
ans[i] = 1;
}
}
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
1116 KB |
3rd lines differ - on the 42nd token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
600 KB |
3rd lines differ - on the 2nd token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
30 ms |
1628 KB |
Output is correct |
2 |
Correct |
49 ms |
1628 KB |
Output is correct |
3 |
Correct |
56 ms |
1628 KB |
Output is correct |
4 |
Correct |
175 ms |
1728 KB |
Output is correct |
5 |
Correct |
36 ms |
1628 KB |
Output is correct |
6 |
Correct |
13 ms |
1736 KB |
Output is correct |
7 |
Correct |
207 ms |
1708 KB |
Output is correct |
8 |
Correct |
5 ms |
1624 KB |
Output is correct |
9 |
Correct |
6 ms |
1624 KB |
Output is correct |
10 |
Correct |
5 ms |
1564 KB |
Output is correct |
11 |
Correct |
4 ms |
1476 KB |
Output is correct |
12 |
Correct |
4 ms |
1628 KB |
Output is correct |
13 |
Correct |
4 ms |
1628 KB |
Output is correct |
14 |
Correct |
4 ms |
1628 KB |
Output is correct |
15 |
Correct |
4 ms |
1628 KB |
Output is correct |
16 |
Correct |
7 ms |
1624 KB |
Output is correct |
17 |
Correct |
4 ms |
1588 KB |
Output is correct |
18 |
Correct |
88 ms |
1372 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
42 ms |
1524 KB |
3rd lines differ - on the 1st token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
1628 KB |
Output is correct |
2 |
Correct |
4 ms |
1684 KB |
Output is correct |
3 |
Correct |
7 ms |
1628 KB |
Output is correct |
4 |
Correct |
4 ms |
1460 KB |
Output is correct |
5 |
Correct |
1 ms |
604 KB |
Output is correct |
6 |
Correct |
2 ms |
1116 KB |
Output is correct |
7 |
Correct |
4 ms |
1372 KB |
Output is correct |
8 |
Correct |
3 ms |
1372 KB |
Output is correct |
9 |
Correct |
2 ms |
1200 KB |
Output is correct |
10 |
Correct |
1 ms |
860 KB |
Output is correct |
11 |
Correct |
2 ms |
1184 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
12 ms |
1116 KB |
3rd lines differ - on the 42nd token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |