# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
424234 |
2021-06-11T18:26:03 Z |
cfalas |
Toy Train (IOI17_train) |
C++14 |
|
845 ms |
1740 KB |
#include "train.h"
#include<bits/stdc++.h>
using namespace std;
#define mp make_pair
#define INF 10000000
#define MOD 1000000007
#define MID ((l+r)/2)
#define HASHMOD 2305843009213693951
#define ll long long
#define ull unsigned long long
#define F first
#define S second
typedef pair<ll, ll> ii;
typedef pair<ii, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef map<int, int> mii;
#define EPS 1e-6
#define FOR(i,n) for(int i=0;i<((int)(n));i++)
#define FORi(i,a,b) for(int i=((int)(a));i<((int)(b));i++)
#define FOA(v, a) for(auto &v : a)
#define len(x) ((int)x.size())
vector<vi> adj;
vector<vi> rev;
vi vis;
vi r;
void dfs(int s){
vis[s] = 1;
for(auto v : adj[s]){
if(!vis[v]) dfs(v);
}
vis[s] = 2;
}
vi who_wins(vi a, vi rr, vi u, vi v) {
r = rr;
int n = len(a);
adj.assign(n, vi());
rev.assign(n, vi());
vis.assign(n,0);
vi res(n, 0);
FOR(i, len(u)){
adj[u[i]].push_back(v[i]);
rev[v[i]].push_back(u[i]);
}
set<int> loop;
FOR(i,n){
if(r[i]==0) continue;
vis.assign(n,0);
dfs(i);
FOA(v,rev[i]) if(vis[v] && r[i]) loop.insert(i);
}
queue<int> q;
vi used(n, 0);
FOA(v,loop) q.push(v), used[v] = true;
while(!q.empty()){
int t = q.front();
q.pop();
res[t] = 1;
FOA(v,rev[t]){
if(!used[v]){
used[v] = true;
q.push(v);
}
}
}
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
139 ms |
1236 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 |
0 ms |
204 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 |
18 ms |
1484 KB |
Output is correct |
2 |
Correct |
32 ms |
1484 KB |
Output is correct |
3 |
Correct |
58 ms |
1512 KB |
Output is correct |
4 |
Correct |
279 ms |
1496 KB |
Output is correct |
5 |
Correct |
56 ms |
1380 KB |
Output is correct |
6 |
Correct |
74 ms |
1396 KB |
Output is correct |
7 |
Correct |
244 ms |
1460 KB |
Output is correct |
8 |
Correct |
11 ms |
1356 KB |
Output is correct |
9 |
Correct |
8 ms |
1396 KB |
Output is correct |
10 |
Correct |
14 ms |
1372 KB |
Output is correct |
11 |
Correct |
8 ms |
1304 KB |
Output is correct |
12 |
Correct |
8 ms |
1228 KB |
Output is correct |
13 |
Correct |
13 ms |
1508 KB |
Output is correct |
14 |
Correct |
9 ms |
1484 KB |
Output is correct |
15 |
Correct |
10 ms |
1720 KB |
Output is correct |
16 |
Correct |
9 ms |
1648 KB |
Output is correct |
17 |
Correct |
9 ms |
1740 KB |
Output is correct |
18 |
Correct |
165 ms |
1352 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
845 ms |
1496 KB |
3rd lines differ - on the 696th token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
1484 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 |
139 ms |
1236 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |