#include "train.h"
using namespace std;
vector < int > Next[5005],ans;
vector < int > who_wins(vector < int > who, vector < int > power, vector < int > u, vector < int > v)
{
int N=who.size(),M=u.size(),i;
for(i=0;i<N;i++) ans.push_back(0);
for(i=0;i<M;i++) Next[u[i]].push_back(v[i]);
for(i=N-1;i>=0;i--)
{
if(Next[i].size()==1)
{
if(Next[i][0]==i+1) ans[i]=ans[i+1];
else ans[i]=power[i];
}
else
{
if(who[i]) ans[i]=power[i]||ans[i+1];
else ans[i]=(!power[i])||(!ans[i+1]);
}
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
844 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
1228 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
972 KB |
3rd lines differ - on the 2nd token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
1228 KB |
3rd lines differ - on the 2nd token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
4 ms |
844 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |