# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
425714 | tc_abd | Wiring (IOI17_wiring) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define It it=se.begin();it!=se.end();it++
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define all(x) begin(x),end(x)
#define unmap unordered_map
#define pii pair<int,int>
#include <bits/stdc++.h>
#define pll pair<ll,ll>
#define vll vector<ll>
#define vi vector<int>
#define ld long double
#define ll long long
#define pb push_back
#define sh short int
#define mid (l+r)/2
#define S second
#define F first
#define sqr 708
using namespace std;
const ll inf = 1e9+1;
const ll mod = 1e9+7;
const int shift = 1e4;
const ld pai=acos(-1);
bool mp[50009][9];
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
int n = a.size(),m = u.size();
for(int i=0;i<m;i++){
if(u[i] == v[i]) mp[u[i]][0] = 1;
else mp[u[i]][1] = 1;
}
vector<int> ret(a.size());
ret[n-1] = r[n-1];
for(int i=n-2;i>=0;i--){
if(r[i]){
if(mp[i][0] == 0 || (a[i] == 0 && mp[i][1] == 1)){
ret[i] = ret[i+1];
}
else ret[i] = 0;
}
else{
if(mp[i][1] == 0 || (a[i] == 0 && mp[i][0] == 1)){
ret[i] = 0;
}
else ret[i] = ret[i+1];
}
}
return ret;
}