이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |