제출 #1234059

#제출 시각아이디문제언어결과실행 시간메모리
1234059MalixA Light Inconvenience (CEOI23_light)C++20
35 / 100
134 ms416 KiB
#include "light.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef vector<vi> vii; typedef pair<int,int> pi; typedef vector<pi> pii; typedef tuple<int,int,int> ti; typedef vector<ll> li; typedef vector<li> lii; #define REP(i,a,b) for(int i=a;i<b;i++) #define F first #define S second #define PB push_back #define LSOne(s) ((s)&(-s)) #define all(x) (x).begin(),(x).end() ll INF=1000000000000000010; int inf=1e9+10; ll M=1e9+7; ll n=1; vector<ll> a(1,1); void prepare(){} std::pair<long long, std::vector<long long>> join(long long p){ vector<ll> b; n+=p; int pos=n; b.PB(pos); while(pos>1){ int k=n-pos+1; int x=max(1,pos-k-1); auto it=lower_bound(all(a),x); if(it!=a.end()&&*it==x)b.PB(x); else{ int y=*it; it--; int z=*it; if(z+p>=x)b.PB(x); else{ b.PB(y); x=y; } } pos=x; } reverse(all(b)); a=b; return {p,a}; } std::pair<long long, std::vector<long long>> leave(long long p){ vector<ll> b; n-=p; while(a.back()>n)a.pop_back(); int pos=n; b.PB(pos); while(pos>1){ int k=n-pos+1; int x=max(1,pos-k-1); auto it=lower_bound(all(a),x); if(it!=a.end()&&*it==x)b.PB(x); else{ int y=*it; it--; int z=*it; if(z+p>=x)b.PB(x); else{ b.PB(y); x=y; } } pos=x; } reverse(all(b)); a=b; return {p,a}; }
#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...