This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fo(i, n) for(ll i = 0; i<(n); i++)
#define F first
#define S second
#define pb push_back
#define deb(x) cout << #x << " = " << (x) << endl
#define deb2(x, y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pl;
typedef vector<pl> vpl;
ll n;
vvl adj(6000);
std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) {
n = a.size();
ll m = u.size();
vl selfEdge(n+1, 0);
fo(i, m){
if(u[i] == v[i]) selfEdge[u[i]] = 1;
else{
adj[u[i]].pb(v[i]);
}
}
vector<int> res(n);
ll last = 0;
for(int i = n-1; i>=0;i--){
if(selfEdge[i] && r[i]==last){
last = a[i]^r[i];
}
res[i] = last;
}
return res;
}
// int main(){
// cin.tie(0)->sync_with_stdio(0);
// vector<int> a = {0, 1};
// vector<int> b = {1, 0};
// vector<int> c = {1, 0, 1};
// vector<int> d = {0, 1, 1};
// vector<int> result = who_wins(a, b, c, d);
// fo(i, result.size()){
// deb(result[i]);
// }
// return 0;
// }
# | 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... |