#include "train.h"
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long
#define pb push_back
typedef pair<ll,ll> pii;
typedef tree<ll, null_type,less<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
const ll MAXN = 2e5+4;
const ll INF = 1e9+7;
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
//vai de u para v
int n =(int)a.size(),m=(int)u.size(),i,cur;
bool self[n],next[n];
for(i=0;i<n;i++){
self[i]=false;
next[i]=false;
}
for(i=0;i<m;i++){
if(u[i]==v[i]){
self[u[i]]=true;
}else{
next[u[i]]=true;
}
}
/*
2 3
0 1
1 0
0 0
0 1
1 1
*/
std::vector<int> res(n);
for(i=0;i<n;i++){cur=i;
//cout<<i<<endl;
while(1){//cout<<cur<<" "<<self[cur]<<" "<<next[cur]<<endl;
while(self[cur]==false)cur++;//pelo menos o ultimo tem de ter
if(a[cur]==r[cur] ){
res[i]=a[cur]; break;
}
if(next[cur]==0){//trapped
res[i]=r[cur]; break;
}
cur++;
}
}
return res;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
460 KB |
Output is correct |
2 |
Correct |
4 ms |
460 KB |
Output is correct |
3 |
Correct |
4 ms |
460 KB |
Output is correct |
4 |
Correct |
3 ms |
460 KB |
Output is correct |
5 |
Correct |
3 ms |
460 KB |
Output is correct |
6 |
Correct |
5 ms |
380 KB |
Output is correct |
7 |
Correct |
4 ms |
460 KB |
Output is correct |
8 |
Correct |
4 ms |
460 KB |
Output is correct |
9 |
Correct |
3 ms |
492 KB |
Output is correct |
10 |
Correct |
3 ms |
460 KB |
Output is correct |
11 |
Correct |
3 ms |
460 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
3rd lines differ - on the 2nd token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
9 ms |
716 KB |
Output is correct |
2 |
Correct |
9 ms |
588 KB |
Output is correct |
3 |
Correct |
10 ms |
612 KB |
Output is correct |
4 |
Incorrect |
11 ms |
704 KB |
3rd lines differ - on the 1st token, expected: '1', found: '0' |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
8 ms |
572 KB |
3rd lines differ - on the 1st token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
9 ms |
588 KB |
3rd lines differ - on the 1st token, expected: '1', found: '0' |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
460 KB |
Output is correct |
2 |
Correct |
4 ms |
460 KB |
Output is correct |
3 |
Correct |
4 ms |
460 KB |
Output is correct |
4 |
Correct |
3 ms |
460 KB |
Output is correct |
5 |
Correct |
3 ms |
460 KB |
Output is correct |
6 |
Correct |
5 ms |
380 KB |
Output is correct |
7 |
Correct |
4 ms |
460 KB |
Output is correct |
8 |
Correct |
4 ms |
460 KB |
Output is correct |
9 |
Correct |
3 ms |
492 KB |
Output is correct |
10 |
Correct |
3 ms |
460 KB |
Output is correct |
11 |
Correct |
3 ms |
460 KB |
Output is correct |
12 |
Incorrect |
0 ms |
204 KB |
3rd lines differ - on the 2nd token, expected: '1', found: '0' |
13 |
Halted |
0 ms |
0 KB |
- |