# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
131848 | 2019-07-17T19:46:01 Z | shafinalam | 사육제 (CEOI14_carnival) | C++14 | 13 ms | 408 KB |
#include <bits/stdc++.h> using namespace std; int ans[1000]; int query(vector<int>v) { int sz = v.size(); cout << sz; for(int i : v) cout << ' ' << i; cout << endl; int x; cin >> x; return x; } int main() { int n; cin >> n; vector<int>arr; arr.push_back(1); for(int i = 2; i <= n; i++) { vector<int>tmp = arr; tmp.push_back(i); if(query(tmp)==tmp.size()) arr = tmp; } for(int i = 0; i < arr.size(); i++) ans[arr[i]] = i+1; for(int i = 1; i <= n; i++) { if(ans[i]) continue; int lo = 0, hi = arr.size()-1, indx; while(lo<=hi) { int mid = (lo+hi)>>1; vector<int>tmp; tmp.push_back(i); for(int r = 0; r < mid; r++) tmp.push_back(arr[r]); if(query(tmp)==tmp.size()) { indx = mid; lo = mid+1; } else hi = mid-1; } ans[i] = ans[arr[indx]]; } cout << 0; for(int i = 1; i <= n; i++) cout << " " << ans[i]; cout << endl; return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 248 KB | Output is correct |
2 | Correct | 9 ms | 248 KB | Output is correct |
3 | Correct | 9 ms | 248 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 6 ms | 376 KB | Output is correct |
6 | Correct | 7 ms | 248 KB | Output is correct |
7 | Correct | 12 ms | 252 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 248 KB | Output is correct |
2 | Correct | 12 ms | 248 KB | Output is correct |
3 | Correct | 8 ms | 248 KB | Output is correct |
4 | Correct | 6 ms | 408 KB | Output is correct |
5 | Correct | 9 ms | 376 KB | Output is correct |
6 | Correct | 8 ms | 248 KB | Output is correct |
7 | Correct | 11 ms | 376 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 248 KB | Output is correct |
2 | Correct | 6 ms | 248 KB | Output is correct |
3 | Correct | 12 ms | 248 KB | Output is correct |
4 | Correct | 5 ms | 248 KB | Output is correct |
5 | Correct | 9 ms | 276 KB | Output is correct |
6 | Correct | 10 ms | 376 KB | Output is correct |
7 | Correct | 13 ms | 248 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 248 KB | Output is correct |
2 | Correct | 5 ms | 248 KB | Output is correct |
3 | Correct | 8 ms | 248 KB | Output is correct |
4 | Correct | 5 ms | 380 KB | Output is correct |
5 | Correct | 9 ms | 400 KB | Output is correct |
6 | Correct | 8 ms | 248 KB | Output is correct |
7 | Correct | 12 ms | 248 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 376 KB | Output is correct |
2 | Correct | 12 ms | 248 KB | Output is correct |
3 | Correct | 10 ms | 376 KB | Output is correct |
4 | Correct | 10 ms | 248 KB | Output is correct |
5 | Correct | 10 ms | 248 KB | Output is correct |
6 | Correct | 7 ms | 248 KB | Output is correct |
7 | Correct | 6 ms | 376 KB | Output is correct |