Submission #966662

#TimeUsernameProblemLanguageResultExecution timeMemory
966662AmrToy Train (IOI17_train)C++17
5 / 100
5 ms860 KiB
#include "train.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; #define sz size() #define F first #define S second const int N = 1e5+2; ll same[N], to[N]; std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) { ll n = a.sz; ll m = u.sz; vector<int> ans(n); for(int i = 0; i < m; i++) { ll x = u[i] , y = v[i]; if(x==y) same[x] = 1; if(y==x+1) to[x] = 1; } for(int i = n-1; i >= 0; i--) { if(a[i]==1){ if(same[i]&&r[i]) ans[i] = 1; else if(to[i]) ans[i] = ans[i+1]; } else { if(same[i]&&r[i]==0) ans[i] = 0; else if(to[i]) ans[i] = ans[i+1]; else ans[i] = 1; } } return ans; }
#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...