Submission #495491

#TimeUsernameProblemLanguageResultExecution timeMemory
495491PedroBigManToy Train (IOI17_train)C++14
12 / 100
95 ms1300 KiB
/* Author of all code: Pedro BIGMAN Dias Last edit: 15/02/2021 */ #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") #pragma GCC optimize("Ofast") #include <iostream> #include <vector> #include <cmath> #include <algorithm> #include <string> #include <map> #include <unordered_map> #include <set> #include <unordered_set> #include <queue> #include <deque> #include <list> #include <iomanip> #include <stdlib.h> #include <time.h> #include <cstring> using namespace std; typedef int ll; typedef unsigned long long int ull; typedef long double ld; #define REP(i,a,b) for(ll i=(ll) a; i<(ll) b; i++) #define pb push_back #define mp make_pair #define pl pair<ll,ll> #define ff first #define ss second #define whole(x) x.begin(),x.end() #define DEBUG(i) cout<<"Pedro Is The Master "<<i<<endl #define INF 500000000LL #define EPS 0.00000001 #define pi 3.14159 #define VV(vvvv,NNNN,xxxx); REP(i,0,NNNN) {vvvv.pb(xxxx);} ll mod=1000000007LL; template<class A=ll> void Out(vector<A> a) {REP(i,0,a.size()) {cout<<a[i]<<" ";} cout<<endl;} template<class A=ll> void In(vector<A> &a, ll N) {A cur; REP(i,0,N) {cin>>cur; a.pb(cur);}} vector<int> who_wins(vector<int> aa, vector<int> rr, vector<int> u, vector<int> v) { vector<ll> a=aa; vector<ll> r=rr; vector<vector<ll> > adj; ll N=a.size(); ll M=u.size(); REP(i,0,N+1) {adj.pb({});} ll S; REP(i,0,N) {if(r[i]==1) {S=i;}} REP(i,0,M) { if(v[i]==S) {v[i]=N;} adj[u[i]].pb(v[i]); } adj[N].pb(S); vector<bool> in; VV(in,N+1,false); in[N]=true; while(1>0) { bool ok=false; REP(i,0,N) { if(in[i]) {continue;} if(a[i]==1) { REP(j,0,adj[i].size()) {if(in[adj[i][j]]) {in[i]=true; ok=true; break;}} } else { bool all=true; REP(j,0,adj[i].size()) {if(!in[adj[i][j]]) {all=false; break;}} if(all) {in[i]=true; ok=true;} } } if(!ok) {break;} } vector<ll> ans; VV(ans,N,0LL); if(!in[S]) {return ans;} REP(i,0,N) {if(in[i]) {ans[i]=1;}} return ans; }

Compilation message (stderr)

train.cpp:5: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    5 | #pragma GCC optimization ("O3")
      | 
train.cpp:6: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    6 | #pragma GCC optimization ("unroll-loops")
      |
#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...