답안 #480435

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
480435 2021-10-16T09:34:09 Z ponytail 사육제 (CEOI14_carnival) C++17
100 / 100
29 ms 272 KB
#include<bits/stdc++.h>
using namespace std;
int query(int L, int R) {
    cout << R-L+1;
    for(int i=L; i<=R; i++) cout << " " << i;
    cout << "\n";
    fflush(stdout);
    int res;cin >> res;return res;
}
int main() {
    int N; cin >> N;
    int ans[N+1];
    ans[1] = 1;
    int now = 2;
    for(int i=2; i<=N; i++) {
        if(query(1, i) != query(1, i-1)) {
            ans[i] = now++;
        }
        else {
            int lb = 1, rb = i-1;
            while(lb < rb) {
                int mid = (lb+rb+1) / 2;
                if(query(mid, i-1) != query(mid, i)) {
                    rb = mid-1;
                }
                else {
                    lb = mid;
                }
            }
            ans[i] = ans[lb];
        }
    } 
    cout<<0;
    for(int i=1; i<=N; i++)cout << " " << ans[i];
    cout << "\n";
}//R...i
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 200 KB Output is correct
2 Correct 22 ms 272 KB Output is correct
3 Correct 7 ms 200 KB Output is correct
4 Correct 8 ms 200 KB Output is correct
5 Correct 25 ms 200 KB Output is correct
6 Correct 18 ms 200 KB Output is correct
7 Correct 17 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 200 KB Output is correct
2 Correct 20 ms 200 KB Output is correct
3 Correct 9 ms 200 KB Output is correct
4 Correct 7 ms 200 KB Output is correct
5 Correct 26 ms 200 KB Output is correct
6 Correct 20 ms 200 KB Output is correct
7 Correct 26 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 200 KB Output is correct
2 Correct 19 ms 200 KB Output is correct
3 Correct 24 ms 200 KB Output is correct
4 Correct 6 ms 200 KB Output is correct
5 Correct 19 ms 200 KB Output is correct
6 Correct 24 ms 200 KB Output is correct
7 Correct 25 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 200 KB Output is correct
2 Correct 21 ms 200 KB Output is correct
3 Correct 10 ms 200 KB Output is correct
4 Correct 4 ms 200 KB Output is correct
5 Correct 21 ms 200 KB Output is correct
6 Correct 17 ms 200 KB Output is correct
7 Correct 18 ms 200 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 23 ms 200 KB Output is correct
2 Correct 29 ms 200 KB Output is correct
3 Correct 18 ms 200 KB Output is correct
4 Correct 13 ms 200 KB Output is correct
5 Correct 17 ms 200 KB Output is correct
6 Correct 12 ms 200 KB Output is correct
7 Correct 8 ms 200 KB Output is correct