Submission #617928

#TimeUsernameProblemLanguageResultExecution timeMemory
617928OzyToy Train (IOI17_train)C++17
5 / 100
9 ms1364 KiB
#include "train.h" #include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for (int i = (a); i <= (b); i++) #define repa(i,a,b) for (int i = (a); i >= (b); i--) #define lli long long int #define debug(a) cout << #a << " = " << a << endl #define debugsl(a) cout << #a << " = " << a << ", " #define MAX 5000 std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) { lli n,m; vector<lli> hijos[MAX]; m = u.size(); rep(i,0,m-1) hijos[u[i]].push_back(v[i]); n = a.size(); vector<int> res; res.resize(n); rep(i,0,n-1) res[i] = a[i]^1; repa(i,n-1,0) { if (a[i] == 1) { for (auto h : hijos[i]) { if (h == i && r[i] == 1) res[i] = 1; else if (res[h] == 1) res[i] = 1; } } else { for (auto h : hijos[i]) { if (h == i && r[i] == 0) res[i] = 0; else if (res[h] == 0) res[i] = 0; } } } 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...