Submission #72955

#TimeUsernameProblemLanguageResultExecution timeMemory
72955SmsSToy Train (IOI17_train)C++14
5 / 100
13 ms1064 KiB
#include<bits/stdc++.h> using namespace std; #define for2(a,b,c) for(int a=b;a<c;a++) #define ll long long #include "train.h" std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) { std::vector<int> res(a.size()); int n = a.size(); int m = u.size(); vector<bool> nxt(n); vector<bool> loop(n); for2(i,0,m){ if(u[i] == v[i]) loop[v[i]] = 1; else nxt[u[i]] = 1; } for(int i = n-1; i >= 0; i--){ if(r[i]){ if(a[i]){ if(loop[i]) res[i] = 1; else if(i!=n-1) res[i] = res[i+1]; }else{ if(nxt[i]) res[i] = res[i+1]; else res[i] = 1; } }else{ if(a[i]){ if(nxt[i]) res[i] = res[i+1]; else res[i] = 0; }else{ if(loop[i]) res[i] = 0; else res[i] = res[i+1]; } } } return res; }
#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...