Submission #1025798

#TimeUsernameProblemLanguageResultExecution timeMemory
1025798parsadox2Toy Train (IOI17_train)C++17
5 / 100
14 ms860 KiB
#include "train.h" #include <bits/stdc++.h> using namespace std; const int N = 5e3 + 10; bool charge[N] , self[N] , ty[N] , nex[N]; int n , m; bool Solve(int v) { for(int i = v ; i < n ; i++) { if(!nex[i]) return charge[i]; if(!self[i]) continue; if(!charge[i] && !ty[i]) return 0; if(charge[i] && ty[i]) return 1; } } vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) { n = a.size() ; m = u.size(); vector<int> res(a.size()); for(int i = 0 ; i < n ; i++) ty[i] = a[i]; for(int i = 0 ; i < n ; i++) charge[i] = r[i]; for(int i = 0 ; i < m ; i++) { if(u[i] == v[i]) self[u[i]] = true; else nex[u[i]] = true; } for(int i = 0 ; i < n ; i++) res[i] = Solve(i); return res; }

Compilation message (stderr)

train.cpp: In function 'bool Solve(int)':
train.cpp:23:1: warning: control reaches end of non-void function [-Wreturn-type]
   23 | }
      | ^
#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...