Submission #422226

#TimeUsernameProblemLanguageResultExecution timeMemory
422226PbezzToy Train (IOI17_train)C++14
5 / 100
11 ms716 KiB
#include "train.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace std; using namespace __gnu_pbds; #define ll long long #define pb push_back typedef pair<ll,ll> pii; typedef tree<ll, null_type,less<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set; const ll MAXN = 2e5+4; const ll INF = 1e9+7; std::vector<int> who_wins(std::vector<int> a, std::vector<int> r, std::vector<int> u, std::vector<int> v) { //vai de u para v int n =(int)a.size(),m=(int)u.size(),i,cur; bool self[n],next[n]; for(i=0;i<n;i++){ self[i]=false; next[i]=false; } for(i=0;i<m;i++){ if(u[i]==v[i]){ self[u[i]]=true; }else{ next[u[i]]=true; } } /* 2 3 0 1 1 0 0 0 0 1 1 1 */ std::vector<int> res(n); for(i=0;i<n;i++){cur=i; //cout<<i<<endl; while(1){//cout<<cur<<" "<<self[cur]<<" "<<next[cur]<<endl; while(self[cur]==false)cur++;//pelo menos o ultimo tem de ter if(a[cur]==r[cur] ){ res[i]=a[cur]; break; } if(next[cur]==0){//trapped res[i]=r[cur]; break; } cur++; } } return res; }
#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...