# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
681081 | Alexandruabcde | 사육제 (CEOI14_carnival) | C++14 | 15 ms | 288 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
constexpr int NMAX = 155;
vector <int> AllDifferent;
bool Question (int ind, int x) {
cout << ind + 2 << " ";
for (int i = 0; i <= ind; ++ i )
cout << AllDifferent[i] << " ";
cout << x << '\n';
cout.flush();
int ans;
cin >> ans;
return (ans == ind + 2);
}
int color[NMAX];
int N;
void BinarySearch (int x) {
int st = 0, dr = AllDifferent.size() - 1;
int pos = AllDifferent.size();
while (st <= dr) {
int mij = (st + dr) / 2;
if (Question(mij, x)) st = mij + 1;
else {
dr = mij - 1;
pos = mij;
}
}
color[x] = pos+1;
if (pos == AllDifferent.size())
AllDifferent.push_back(x);
}
int main () {
cin >> N;
AllDifferent.push_back(1);
color[1] = 1;
for (int i = 2; i <= N; ++ i ) {
BinarySearch(i);
}
cout << 0 << " ";
for (int i = 1; i <= N; ++ i )
cout << color[i] << " ";
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... |