Submission #1060191

#TimeUsernameProblemLanguageResultExecution timeMemory
1060191ZicrusToy Train (IOI17_train)C++17
5 / 100
6 ms1372 KiB
#include <bits/stdc++.h> #include "train.h" using namespace std; typedef long long ll; vector<vector<ll>> adj; vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) { ll n = a.size(), m = u.size(); vector<int> res(n); adj = vector<vector<ll>>(n); for (int i = 0; i < m; i++) { adj[u[i]].push_back(v[i]); } for (int i = n-1; i >= 0; i--) { bool win = false; if (a[i]) { for (auto &e : adj[i]) { if (e != i && res[e]) win = true; if (e == i && r[i]) win = true; } res[i] = win; } else { for (auto &e : adj[i]) { if (e != i && !res[e]) win = true; if (e == i && !r[i]) win = true; } res[i] = !win; } } 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...