Submission #794155

#TimeUsernameProblemLanguageResultExecution timeMemory
794155alvingogoToy Train (IOI17_train)C++14
0 / 100
1818 ms1012 KiB
#include "train.h" #include <bits/stdc++.h> #pragma GCC optimize("Ofast") #define AquA cin.tie(0);ios_base::sync_with_stdio(0); #define fs first #define sc second #define p_q priority_queue using namespace std; typedef long long ll; vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) { int n=a.size(),m=u.size(); vector<int> ans(n); vector<ll> dis(n),val(n); for(int i=0;i<n;i++){ if(r[i]==0){ val[i]=-1; } else{ val[i]=1e9; } } for(int i=0;i<n;i++){ auto dz=dis; for(int j=0;j<m;j++){ ll p=dis[v[j]]+val[v[j]]*(val[v[j]]<0 || v[j]!=u[j]); if(a[u[j]]==1){ dz[u[j]]=max(dz[u[j]],p); } else{ dz[u[j]]=min(dz[u[j]],p); } } dis=dz; } auto dz=dis; for(int i=0;i<m;i++){ for(int j=0;j<m;j++){ ll p=dis[v[j]]+val[v[j]]*(val[v[j]]<0 || v[j]!=u[j]); if(a[u[j]]==1){ dz[u[j]]=max(dz[u[j]],p); } else{ dz[u[j]]=min(dz[u[j]],p); } } } for(int i=0;i<n;i++){ ans[i]=(dz[i]==dis[i]); } return ans; }
#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...