제출 #88587

#제출 시각아이디문제언어결과실행 시간메모리
88587amiratouRoller Coaster Railroad (IOI16_railroad)C++14
0 / 100
236 ms32800 KiB
#include <bits/stdc++.h> using namespace std; #define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0) #define debug(x) cerr << " - " << #x << ": " << x << endl; #define debugs(x, y) cerr << " - " << #x << ": " << x << " " << #y << ": " << y << endl; #define sep() cerr << "--------------------" << endl; #define all(x) (x).begin(),(x).end() #define sz(x) (ll)x.size() #define fi first #define se second #define ll long long #define ii pair<int,int> #define v vector<int> #define vv vector<vector<int> > #define pb push_back #define INF LLONG_MAX using namespace std; vector<int> limit,exitsp; int n; set<pair<int,int> > myset; bool check(ll curr){ while(!myset.empty()){ /*debug(curr); for(auto it:myset) cout<<it.fi<<" "<<it.se<<"\n"; sep()*/ auto search=myset.upper_bound({curr,0}); if(search==myset.end())return 0; //debug(search->fi); if(search!=myset.begin()){ search--; if(search->fi<curr) search++; } curr=exitsp[search->se]; myset.erase(search); } return 1; } long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) { n = (int) s.size(); exitsp=t; for (int i = 0; i < n; ++i) myset.insert({s[i],i}); auto temp=myset.begin(); myset.erase(myset.begin()); /*for (int i = 0; i < n; ++i) { //debug(i); myset.erase(myset.find({s[i],i}));*/ if(check(t[temp->se])) return 0; /*myset.clear(); for (int j = 0; j < n; ++j) myset.insert({s[j],j}); }*/ return INF-5; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...