답안 #161731

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
161731 2019-11-04T09:54:17 Z dantoh000 사육제 (CEOI14_carnival) C++14
100 / 100
37 ms 380 KB
#include <bits/stdc++.h>
using namespace std;
int n,c;
int ans[155];
int first[155];
int query(int n){
    cout << n << " ";
    for (int i = 1; i <= n; i++) cout << i << " ";
    cout << endl;
    int ans;
    cin >> ans;
    return ans;
}
int query(int s, int e){
    cout << e-s+1 << " ";
    for (int i = s; i <= e; i++) cout << first[i] << " ";
    cout << endl;
    int ans;
    cin >> ans;
    return ans;
}
int query(int x, int s, int e){
    cout << e-s+2 << " ";
    cout << x << " ";
    for (int i = s; i <= e; i++) cout << first[i] << " ";
    cout << endl;
    int ans;
    cin >> ans;
    return ans;
}
int main(){
    cin >> n;
    c = query(n);
    int cur = 1;
    first[1] = 1;
    ans[1] = 1;
    int last = 1;
    for (int i = 2; i <= n; i++){
        int qf = query(i);
        if (qf == last){
            int lo = 1, hi = cur;
            while (lo+1 < hi){
                int mid =  (lo+hi)/2;
                if (query(i,lo,mid) == query(lo,mid)){
                    hi = mid;
                }
                else{
                    lo = mid;
                }
            }
            if (lo + 1 == hi){
                if (query(i,lo,lo) == 1){
                    hi = lo;
                }
                else lo = hi;
            }
            ans[i] = lo;
        }
        else{
            cur++;
            ans[i] = cur;
            first[cur] = i;
        }
        last = qf;
    }
    cout << "0 ";
    for (int i = 1; i <= n; i++) cout << ans[i] << " ";
    cout << endl;
    return 0;


}
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 296 KB Output is correct
2 Correct 17 ms 376 KB Output is correct
3 Correct 12 ms 376 KB Output is correct
4 Correct 5 ms 248 KB Output is correct
5 Correct 8 ms 376 KB Output is correct
6 Correct 4 ms 296 KB Output is correct
7 Correct 20 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 376 KB Output is correct
2 Correct 31 ms 248 KB Output is correct
3 Correct 8 ms 376 KB Output is correct
4 Correct 5 ms 296 KB Output is correct
5 Correct 13 ms 376 KB Output is correct
6 Correct 13 ms 248 KB Output is correct
7 Correct 17 ms 248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 376 KB Output is correct
2 Correct 13 ms 376 KB Output is correct
3 Correct 9 ms 376 KB Output is correct
4 Correct 6 ms 248 KB Output is correct
5 Correct 9 ms 376 KB Output is correct
6 Correct 8 ms 248 KB Output is correct
7 Correct 20 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 248 KB Output is correct
2 Correct 14 ms 252 KB Output is correct
3 Correct 7 ms 248 KB Output is correct
4 Correct 6 ms 248 KB Output is correct
5 Correct 16 ms 248 KB Output is correct
6 Correct 8 ms 380 KB Output is correct
7 Correct 37 ms 252 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 252 KB Output is correct
2 Correct 18 ms 376 KB Output is correct
3 Correct 12 ms 248 KB Output is correct
4 Correct 11 ms 248 KB Output is correct
5 Correct 8 ms 248 KB Output is correct
6 Correct 17 ms 248 KB Output is correct
7 Correct 5 ms 248 KB Output is correct