# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
475237 | 2021-09-21T15:05:31 Z | MohamedAhmed04 | 사육제 (CEOI14_carnival) | C++14 | 10 ms | 304 KB |
#include <bits/stdc++.h> using namespace std ; const int MAX = 1e5 + 10 ; int ans[MAX] ; int n ; int query(vector<int>&v) { cout<<v.size() ; for(auto &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} , v2 ; ans[1] = 1 ; for(int i = 2 ; i <= n ; ++i) { v.push_back(i) ; int x = query(v) ; if(x == v.size()) { ans[i] = v.size() ; continue ; } v.pop_back() ; int l = 0 , r = v.size() - 1 , idx = -1 ; while(l <= r) { int mid = (l + r) >> 1 ; v2.clear() ; for(int i = 0 ; i <= mid ; ++i) v2.push_back(v[i]) ; v2.push_back(i) ; if(query(v2) == v2.size() - 1) idx = mid , r = mid-1 ; else l = mid+1 ; } assert(idx != -1) ; ans[i] = ans[v[idx]] ; } cout<<0 ; for(int i = 1 ; i <= n ; ++i) cout<<" "<<ans[i] ; cout<<endl ; return 0 ; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 200 KB | Output is correct |
2 | Correct | 9 ms | 200 KB | Output is correct |
3 | Correct | 8 ms | 296 KB | Output is correct |
4 | Correct | 4 ms | 200 KB | Output is correct |
5 | Correct | 5 ms | 200 KB | Output is correct |
6 | Correct | 4 ms | 200 KB | Output is correct |
7 | Correct | 7 ms | 200 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 200 KB | Output is correct |
2 | Correct | 10 ms | 200 KB | Output is correct |
3 | Correct | 4 ms | 200 KB | Output is correct |
4 | Correct | 4 ms | 200 KB | Output is correct |
5 | Correct | 6 ms | 200 KB | Output is correct |
6 | Correct | 7 ms | 200 KB | Output is correct |
7 | Correct | 7 ms | 200 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 200 KB | Output is correct |
2 | Correct | 5 ms | 200 KB | Output is correct |
3 | Correct | 8 ms | 200 KB | Output is correct |
4 | Correct | 4 ms | 296 KB | Output is correct |
5 | Correct | 6 ms | 200 KB | Output is correct |
6 | Correct | 6 ms | 200 KB | Output is correct |
7 | Correct | 9 ms | 200 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 200 KB | Output is correct |
2 | Correct | 7 ms | 200 KB | Output is correct |
3 | Correct | 6 ms | 200 KB | Output is correct |
4 | Correct | 4 ms | 200 KB | Output is correct |
5 | Correct | 8 ms | 200 KB | Output is correct |
6 | Correct | 6 ms | 200 KB | Output is correct |
7 | Correct | 8 ms | 200 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 200 KB | Output is correct |
2 | Correct | 9 ms | 200 KB | Output is correct |
3 | Correct | 5 ms | 200 KB | Output is correct |
4 | Correct | 4 ms | 200 KB | Output is correct |
5 | Correct | 7 ms | 200 KB | Output is correct |
6 | Correct | 5 ms | 200 KB | Output is correct |
7 | Correct | 5 ms | 304 KB | Output is correct |