Submission #428480

#TimeUsernameProblemLanguageResultExecution timeMemory
428480yuto1115Toy Train (IOI17_train)C++17
5 / 100
9 ms1228 KiB
#include "train.h" #include<bits/stdc++.h> #define rep(i, n) for(ll i = 0; i < ll(n); i++) #define rep2(i, s, n) for(ll i = ll(s); i < ll(n); i++) #define rrep(i, n) for(ll i = ll(n)-1; i >= 0; i--) #define pb push_back #define eb emplace_back #define all(a) a.begin(),a.end() #define rall(a) a.rbegin(),a.rend() using namespace std; using ll = long long; using P = pair<int, int>; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; using vp = vector<P>; using vvp = vector<vp>; using vb = vector<bool>; using vvb = vector<vb>; using vs = vector<string>; const int inf = 1001001001; const ll linf = 1001001001001001001; template<class T> bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template<class T> bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } vi who_wins(vi a, vi r, vi u, vi v) { int n = a.size(); int m = u.size(); vvi G(n); rep(i, m) G[u[i]].pb(v[i]); vi dp(n); rrep(i, n) { if (a[i]) { for (int j : G[i]) { if (i == j) dp[i] |= r[i]; else dp[i] |= dp[j]; } } else { dp[i] = 1; for (int j : G[i]) { if (i == j) dp[i] &= r[i]; else dp[i] &= dp[j]; } } } 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...