Submission #485466

#TimeUsernameProblemLanguageResultExecution timeMemory
485466PedroBigManToy Train (IOI17_train)C++14
0 / 100
5 ms844 KiB
#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 "train.h" 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 100000000000000000LL ll insig; #define In(vecBRO, LENBRO) REP(IBRO,0,LENBRO) {cin>>insig; vecBRO.pb(insig);} void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;} vector<ll> ps; ll PS(ll l, ll r) { if(l==0) {return ps[r];} else {return (ps[r]-ps[l-1]);} } vector<int> who_wins(vector<int> a, vector<int> r, vector<int> u, vector<int> v) { ll N = a.size(); ll M = u.size(); vector<ll> type; //type 0: connects to itself, type 1: connects to next, type 2: connects to both REP(i,0,N) {type.pb(-1);} REP(i,0,M) { if(u[i]==v[i]) { if(type[u[i]]==-1) {type[u[i]]=0;} else {type[u[i]]=2;} } else { if(type[u[i]]==-1) {type[u[i]]=0;} else {type[u[i]]=2;} } } vector<ll> goodloop; REP(i,0,N) {if((a[i]==1 && type[i]!=1) || type[i]==0) {goodloop.pb(i);}} vector<ll> ans; REP(i,0,N) {ans.pb(-1);} vector<ll> Bloop; REP(i,0,N) {Bloop.pb(0); if(type[i]!=1 && a[i]==0) {Bloop[i]=1;}} ll cursum=0; REP(i,0,N) {cursum+=Bloop[i]; ps.pb(cursum);} REP(s,0,N) { ll nxt = *lower_bound(whole(goodloop),s); if(PS(s,nxt)==0) {ans[s]=1;} else {ans[s]=0;} } 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...