Submission #1052336

#TimeUsernameProblemLanguageResultExecution timeMemory
1052336UnforgettableplToy Train (IOI17_train)C++17
5 / 100
4 ms992 KiB
#include "train.h" #include <bits/stdc++.h> using namespace std; vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) { int n = a.size(); int m = u.size(); vector<bool> presentself(n); vector<bool> presentnext(n); for(int i=0;i<m;i++) { if(v[i]==u[i])presentself[u[i]]=true; else presentnext[u[i]]=true; } vector<int> wins(n,-1); for(int i=0;i<n;i++){ bool want_cycle = a[i]==r[i]; bool get_cycle = !presentnext[i] or (want_cycle and presentself[i]); if(get_cycle) { if(want_cycle)wins[i]=a[i]; else wins[i]=a[i]^1; } } for(int i=n-2;i>=0;i--)if(wins[i]==-1)wins[i]=wins[i+1]; return wins; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...