Submission #429289

#TimeUsernameProblemLanguageResultExecution timeMemory
429289Dremix10Toy Train (IOI17_train)C++17
0 / 100
7 ms1484 KiB
#include "train.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef unsigned long long ull; typedef pair<int,int> pi; typedef pair<ll,ll> pl; #define F first #define S second #define endl '\n' #define all(x) (x).begin(),(x).end() #ifdef dremix #define p(x) cerr<<#x<<" = "<<x<<endl; #define p2(x,y) cerr<<#x<<", "<<#y<<" = {"<<x<<", "<<y<<"}"<<endl; #define pp(x) cerr<<#x<<" = "<<"("<<x.F<<" - "<<x.S<<")"<<endl; #define pv(x) cerr<<#x<<" = "<<"{";for(auto y : x)cerr<<y<<", ";cerr<<"}"<<endl; #define ppv(x) cerr<<#x<<" = "<<"{";for(auto y : x)cerr<<y.F<<"-"<<y.S<<", ";cerr<<"}"<<endl; #else #define p(x) #define p2(x,y) #define pp(x) #define pv(x) #define ppv(x) #endif #define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); const int maxp = 22; const ld EPS = 1e-9; const ll INF = 1e18; const int MOD = 1e9+7; const int N = 15; vector<vector<int> > adj(N); bool vv[N]; vector<int> aa,rr; bool solve(int s, bool power){ p2(s,power) p(vv[s]) if(vv[s])return power; power |= rr[s]; p2(s,power) vv[s] = true; if(aa[s]){ bool ans = false; for(auto x : adj[s]) ans |= solve(x,power); p2(s,ans) return ans; } bool ans = true; for(auto x : adj[s]) ans &= solve(x,power); p2(s,ans) return ans; } vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) { int n = a.size(); int m = u.size(); aa = a; rr = r; int i,j; for(i=0;i<m;i++){ int x = u[i]; int y = v[i]; adj[x].push_back(y); } vector<int> ans(n); for(i=0;i<n;i++){ for(j=0;j<n;j++)vv[j] = false; ans[i] = solve(i,false); p2(i,ans[i]) } return ans; /* g++ grader.cpp trainSub.cpp -Ddremix */ }
#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...