# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
641112 |
2022-09-16T02:22:29 Z |
ggoh |
Toy Train (IOI17_train) |
C++14 |
|
99 ms |
1236 KB |
#include "train.h"
#include<bits/stdc++.h>
using namespace std;
#define sz(v) ((int)(v).size())
typedef long long lint;
typedef pair<int,int>pii;
int n,m,ch[5005],is[2];
vector<int>G[5005],T;
void f(int p, vector<int> &a)
{
while(1)
{
T.clear();
for(int i=0;i<n;i++)
{
if(ch[i]!=p)
{
is[0]=is[1]=0;
for(auto &k:G[i])
{
if(ch[k]==p)is[p]=1;
else is[1-p]=1;
}
if((a[i]==p && is[a[i]]) || (a[i]!=p && !is[a[i]]))T.push_back(i);
}
}
if(!T.size())break;
for(auto &k:T)ch[k]=p;
}
}
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
n=sz(a);m=sz(u);
vector<int> res(n);
for(int i=0;i<m;i++)G[u[i]].push_back(v[i]);
for(int i=0;i<n;i++)ch[r[i]]=1;
f(1,a);
f(0,a);
for(int i=0;i<n;i++)res[i]=ch[i];
return res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
852 KB |
3rd lines differ - on the 14th token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 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 |
Incorrect |
99 ms |
1236 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 |
5 ms |
980 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 |
Incorrect |
9 ms |
1172 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 |
Incorrect |
4 ms |
852 KB |
3rd lines differ - on the 14th token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |