# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
274109 | toonewbie | 사육제 (CEOI14_carnival) | C++17 | 11 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define F first
#define S second
#define pb push_back
//#define endl '\n'
#define ll long long
#define pi pair<int,int>
using namespace std;
const int MOD = 1e9 + 7;
const int N = 155;
int n, res[N];
int ask(vector<int> v) {
cout << v.size() << " ";
for (int i : v) cout << i << " ";
cout << endl;
int x; cin >> x;
return x;
}
int main() {
ios_base :: sync_with_stdio(0);
cin.tie(0);
cin >> n;
vector<int> v = {1};
int say = 1; res[1] = 1;
for (int i = 2; i <= n; i++) {
v.pb(i);
if (ask(v) == say + 1) {
say++;
res[i] = say;
} else v.pop_back();
}
for (int i = 1; i <= n; i++) {
if (res[i] == 0) {
int l = 0, r = (int)v.size() - 1, id;
while(r - l >= 0) {
int mid = (l + r) >> 1;
vector<int> tmp = {i};
for (int i = 0; i <= mid; i++) tmp.pb(v[i]);
/// mid + 1
if (ask(tmp) == mid + 1) {
id = mid;
r = mid - 1;
} else l = mid + 1;
}
res[i] = res[v[id]];
}
}
cout << 0 << " ";
for (int i = 1; i <= n; i++) {
cout << res[i] << " ";
}
cout << endl;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |