| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 581248 | Meloric | Art Collections (BOI22_art) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "art.h"
#define pb push_back
#define int int64_t
#define pii pair<int, int>
#define X first
#define Y second
#define all(x) (x).begin(),(x).end()
#define lb lower_bound
#define ub upper_bound
using namespace std;
const int inf = 1e18;
void p(auto A){
for(auto e : A)cout << e << ' ';
cout << '\n';
}
vector<int> gen(int a, int N){
vector<int> ret;
ret.pb(a);
for(int i = 1; i<= N; i++){
if(i == a)continue;
ret.pb(i);
}
return ret;
}
void solve(int N){
int x = publish(gen(1, N));
vector<int> A(N+1);
for(int i = 2; i<= N; i++)A[i] = (publish(gen(i, N))-(x-i+1))/2;
vector<int> ans;
priority_queue<int> pq;
for(int i = 1; i<= N; i++)if(A[i] == 0)pq.push(i);
while(pq.size()){
int c = pq.top();
pq.pop();
ans.pb(c);
for(int i = c; i<= N; i++){
A[i]--;
if(A[i] == 0)pq.push(i);
}
}
answer(ans);
}
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
//int t = 1;
cin >> t;
while(t--)solve();
}
