Submission #71024

#TimeUsernameProblemLanguageResultExecution timeMemory
71024funcsrToy Train (IOI17_train)C++17
0 / 100
17 ms6568 KiB
#include "train.h" #include <iostream> #include <vector> #include <queue> #include <set> #include <algorithm> #include <cassert> #define rep(i, n) for (int i=0; i<(n); i++) #define all(x) (x).begin(), (x).end() #define pb push_back #define INF (1LL<<60) #define _1 first #define _2 second using namespace std; typedef pair<int, int> P; int N, M; vector<int> G[100000]; vector<int> who_wins(vector<int> owner, vector<int> color, vector<int> U, vector<int> V) { N = owner.size(), M = U.size(); vector<int> win(N); rep(i, M) G[U[i]].pb(V[i]), assert(V[i] == U[i] || V[i] == U[i]+1); for (int x=N-1; x>=0; x--) { bool loop = false; for (int t : G[x]) if (x == t) loop = true; //A if (owner[x] == 1) { if (color[x] && loop) win[x] = 1; else { if (x+1<N) win[x] = win[x+1]; else win[x] = 0; } } else { if (!color[x] && loop) win[x] = 0; else { if (x+1<N) win[x] = win[x+1]; else win[x] = 1; } } } return win; }
#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...