제출 #1119299

#제출 시각아이디문제언어결과실행 시간메모리
1119299groshiA Light Inconvenience (CEOI23_light)C++17
100 / 100
890 ms592 KiB
#include<bits/stdc++.h> #include "light.h" #define int long long using namespace std; int n=1; vector<int> teraz; void prepare() { teraz.push_back(1); } void zmien(int p) { vector<int> nowe; nowe.push_back(n); int jestem=n; while(jestem>1) { jestem-=(n-jestem+2); if(jestem<=0) jestem=1; int gdzie=upper_bound(teraz.begin(),teraz.end(),jestem)-teraz.begin(); gdzie--; if(jestem-teraz[gdzie]>p) jestem=teraz[gdzie+1]; nowe.push_back(jestem); } reverse(nowe.begin(),nowe.end()); swap(nowe,teraz); } pair<int,vector<int> > join(int p) { n+=p; zmien(p); return {p,teraz}; } pair<int,vector<int> > leave(int p) { n-=p; zmien(p); return {p,teraz}; } /*int32_t main() { prepare(); while(true) { int typ,ile; cin>>typ>>ile; pair<int,vector<int> > mam; if(typ==0) mam=join(ile); else mam=leave(ile); cout<<mam.first<<" "; for(int i=0;i<mam.second.size();i++) cout<<mam.second[i]<<" "; cout<<"\n"; } }*/
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...