Submission #72899

#TimeUsernameProblemLanguageResultExecution timeMemory
72899NavickToy Train (IOI17_train)C++17
5 / 100
9 ms1008 KiB
#include <bits/stdc++.h> #include "train.h" #define F first #define S second #define pii pair<int, int> #define pb push_back using namespace std; typedef long long ll; typedef long double ld; const int maxN = 5e3 + 10; bool nex[maxN], tog[maxN]; bool w[maxN]; std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) { int n = a.size(), m = u.size(); for (int i=0; i<m; i++) { if(u[i] == v[i]) tog[u[i]] = true; else if(u[i] + 1 == v[i]) nex[u[i]] = true; } for (int i=n-1; i>=0; i--) { if(a[i]) { if(r[i] && tog[i]) w[i] = true; else if(nex[i]) w[i] = w[i + 1]; else w[i] = false; }else { if(!r[i] && tog[i]) w[i] = false; else if(nex[i]) w[i] = w[i + 1]; else w[i] = true; } } vector <int> ans; for (int i=0; i<n; i++) ans.pb(w[i]); 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...