#include "train.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
int m=u.size(),n=a.size();
vector<int>res(n),dp(n);
for(int i=0;i<n;i++){
res[i]=0;
dp[i]=0;
}
bool flag=0;
for(int i=0;i<m;i++){
if(v[i]!=u[i] && v[i]!=(u[i]+1)) flag=1;
}
if(flag==0){
for(int i=0;i<m;i++){
if(u[i]+1==v[i]) dp[u[i]]=1;
}
if(r[n-1]==1){
res[n-1]=1;
}
else{
res[n-1]=0;
}
for(int i=n-2;i>=0;i--){
if((dp[i]==1 && res[i+1]==1) || (a[i]==1 && r[i]==1)) res[i]=1;
}
return res;
}
for(int i = 0; i < (int)res.size(); i++)
res[i] = i % 2;
return res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
460 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
276 KB |
3rd lines differ - on the 3rd token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
12 ms |
612 KB |
3rd lines differ - on the 2nd token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
572 KB |
3rd lines differ - on the 1st token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
7 ms |
716 KB |
3rd lines differ - on the 1st token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
6 ms |
460 KB |
3rd lines differ - on the 1st token, expected: '0', found: '1' |
2 |
Halted |
0 ms |
0 KB |
- |