This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*input
5 7
0 1 0 0 0
1 1 0 1 1
0 1
1 2
3 4
0 0
1 1
2 2
4 4
0 1 0 0 1
*/
#include "train.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define REP(i,n) for(int i = 0;i < n;i++)
const int N = 5001;
int n,m;
bool self[N];
bool nxt[N];
vector<int> who_wins(vector<int> a, vector<int> r,vector<int> u, vector<int> v) {
n = a.size();
m = u.size();
REP(i,n){
nxt[i] = 0;
self[i] = 0;
}
vector<int> ans;
REP(i,m){
if(u[i] == v[i])self[u[i]] = 1;
else nxt[u[i]] = 1;
}
REP(i,n){
assert(nxt[i]|self[i]);
}
REP(i,n){
int cur = i;
bool wins = 0;
while(cur < n){
cout << cur << endl;
if(a[cur]){
if(r[cur]){
if(self[cur]){
wins = 1;
break;
}
cur++;
}
else{
if(!nxt[cur]){
wins = 0;
break;
}
cur++;
}
}
else{
if(r[cur]){
if(!nxt[cur]){
wins = 1;
break;
}
cur++;
}
else{
if(self[cur]){
wins = 0;;
break;
}
cur++;
}
}
}
ans.pb(wins);
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |