답안 #25732

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
25732 2017-06-23T19:30:21 Z gs14004 사육제 (CEOI14_carnival) C++11
100 / 100
39 ms 2024 KB
#include <bits/stdc++.h>
using namespace std;

int party(set<int> s){
    printf("%d\n", s.size());
    fflush(stdout);
    for(auto &i : s) printf("%d ", i);
    fflush(stdout);
    int ret;
    scanf("%d",&ret);
    return ret;
}

void findClothes(int N, vector<int> &C)
{
    int size[151] = {};
    int piv = 0;
    set<int> s;
    for(int i=1; i<=N; i++){
        s.insert(i);
        size[i] = party(s);
        if(size[i] == size[i-1]){
            int s = 1, e = i-1;
            while (s != e) {
                int m = (s+e)/2;
                set<int> original;
                for (int i=s; i<=m; i++) {
                    original.insert(i);
                }
                int v = party(original);
                original.insert(i);
                if(v != party(original)) s = m+1;
                else e = m;
            }
            C.push_back(C[e-1]);
        }
        else{
            C.push_back(++piv);
        }
    }
}

int main(){
    int n; cin >> n;
    vector<int> v;
    findClothes(n, v);
    printf("0\n");
    for(auto &i : v) printf("%d ", i);
}

Compilation message

carnival.cpp: In function 'int party(std::set<int>)':
carnival.cpp:5:28: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::set<int>::size_type {aka long unsigned int}' [-Wformat=]
     printf("%d\n", s.size());
                            ^
carnival.cpp:10:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&ret);
                     ^
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 2024 KB Output is correct
2 Correct 19 ms 2024 KB Output is correct
3 Correct 9 ms 2024 KB Output is correct
4 Correct 3 ms 2024 KB Output is correct
5 Correct 6 ms 2024 KB Output is correct
6 Correct 19 ms 2024 KB Output is correct
7 Correct 6 ms 2024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 2024 KB Output is correct
2 Correct 13 ms 2024 KB Output is correct
3 Correct 9 ms 2024 KB Output is correct
4 Correct 6 ms 2024 KB Output is correct
5 Correct 26 ms 2024 KB Output is correct
6 Correct 16 ms 2024 KB Output is correct
7 Correct 23 ms 2024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 2024 KB Output is correct
2 Correct 6 ms 2024 KB Output is correct
3 Correct 16 ms 2024 KB Output is correct
4 Correct 0 ms 2024 KB Output is correct
5 Correct 13 ms 2024 KB Output is correct
6 Correct 19 ms 2024 KB Output is correct
7 Correct 19 ms 2024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 2024 KB Output is correct
2 Correct 19 ms 2024 KB Output is correct
3 Correct 6 ms 2024 KB Output is correct
4 Correct 9 ms 2024 KB Output is correct
5 Correct 13 ms 2024 KB Output is correct
6 Correct 0 ms 2024 KB Output is correct
7 Correct 9 ms 2024 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 2024 KB Output is correct
2 Correct 39 ms 2024 KB Output is correct
3 Correct 26 ms 2024 KB Output is correct
4 Correct 26 ms 2024 KB Output is correct
5 Correct 19 ms 2024 KB Output is correct
6 Correct 6 ms 2024 KB Output is correct
7 Correct 3 ms 2024 KB Output is correct