제출 #837448

#제출 시각아이디문제언어결과실행 시간메모리
837448JohannToy Train (IOI17_train)C++14
5 / 100
5 ms852 KiB
#include "train.h" #include "bits/stdc++.h" using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vvi; #define sz(x) (int)(x).size() #define all(x) (x).begin(), (x).end() int N, M; std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) { N = sz(a); M = sz(u); vi hasSelfLoop(N, false); vi connectsToNext(N, false); for (int i = 0; i < M; ++i) if (v[i] == u[i]) hasSelfLoop[u[i]] = true; else connectsToNext[u[i]] = true; vi dp(N, false); for (int v = N - 1; v >= 0; --v) { if (a[v] == 1) { // A is turn if ((hasSelfLoop[v] && r[v]) || (v < N && connectsToNext[v] && dp[v + 1])) dp[v] = true; else dp[v] = false; } else { // B turn if ((hasSelfLoop[v] && !r[v]) || (v < N && connectsToNext[v] && !dp[v + 1])) dp[v] = false; else dp[v] = true; } } return dp; }
#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...