#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 |
Correct |
4 ms |
716 KB |
Output is correct |
2 |
Correct |
4 ms |
844 KB |
Output is correct |
3 |
Correct |
5 ms |
844 KB |
Output is correct |
4 |
Correct |
5 ms |
800 KB |
Output is correct |
5 |
Correct |
4 ms |
844 KB |
Output is correct |
6 |
Correct |
4 ms |
856 KB |
Output is correct |
7 |
Correct |
4 ms |
796 KB |
Output is correct |
8 |
Correct |
4 ms |
844 KB |
Output is correct |
9 |
Correct |
5 ms |
844 KB |
Output is correct |
10 |
Correct |
6 ms |
844 KB |
Output is correct |
11 |
Correct |
5 ms |
716 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
972 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
844 KB |
3rd lines differ - on the 8th token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
972 KB |
3rd lines differ - on the 1st token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
716 KB |
Output is correct |
2 |
Correct |
4 ms |
844 KB |
Output is correct |
3 |
Correct |
5 ms |
844 KB |
Output is correct |
4 |
Correct |
5 ms |
800 KB |
Output is correct |
5 |
Correct |
4 ms |
844 KB |
Output is correct |
6 |
Correct |
4 ms |
856 KB |
Output is correct |
7 |
Correct |
4 ms |
796 KB |
Output is correct |
8 |
Correct |
4 ms |
844 KB |
Output is correct |
9 |
Correct |
5 ms |
844 KB |
Output is correct |
10 |
Correct |
6 ms |
844 KB |
Output is correct |
11 |
Correct |
5 ms |
716 KB |
Output is correct |
12 |
Incorrect |
1 ms |
332 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
13 |
Halted |
0 ms |
0 KB |
- |