# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
794180 | alvingogo | Toy Train (IOI17_train) | C++14 | 5 ms | 1236 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.
#include "train.h"
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define AquA cin.tie(0);ios_base::sync_with_stdio(0);
#define fs first
#define sc second
#define p_q priority_queue
using namespace std;
typedef long long ll;
const ll inf=1e9;
void print(auto& a){
return;
for(auto h:a){
cerr << h << " ";
}
cerr << "\n";
}
vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) {
int n=a.size(),m=u.size();
vector<int> ans(n);
vector<vector<int> > e(n);
for(int i=0;i<m;i++){
e[u[i]].push_back(v[i]);
}
for(int i=n-1;i>=0;i--){
int mx=0,mn=1;
for(auto y:e[i]){
if(y==i){
if(r[i]==1){
mx=1;
}
else{
mn=0;
}
}
else{
mx=max(mx,ans[y]);
mn=min(mn,ans[y]);
}
}
if(a[i]==0){
ans[i]=mn;
}
else{
ans[i]=mx;
}
}
return ans;
}
Compilation message (stderr)
# | 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... |