제출 #73009

#제출 시각아이디문제언어결과실행 시간메모리
73009KmcodeRoller Coaster Railroad (IOI16_railroad)C++14
0 / 100
176 ms10776 KiB
#include<bits/stdc++.h> using namespace std; //#include "railroad.h" vector<pair<int,int> > v; map<int,int> same; long long plan_roller_coaster(std::vector<int> s, std::vector<int> t) { int n = (int) s.size(); for(int i=0;i<n;i++){ if(s[i]==t[i]){ v.push_back(make_pair(s[i],1)); continue; } v.push_back(make_pair(s[i],2)); v.push_back(make_pair(t[i],0)); } sort(v.begin(),v.end()); bool ok=false; int stk=0; int en=0; while( v.size() ) { auto f=v.back(); v.pop_back(); if(f.second==2){ stk++; } else{ if(f.second==1){ v.push_back(make_pair(f.first,2)); v.push_back(make_pair(f.first,0)); continue; } if(stk){ stk--; continue; } if(stk==0){ if(en==0){ en=1; continue; } ok=true; break; } } } return ok; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...