답안 #48129

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
48129 2018-05-10T06:28:10 Z jeff 사육제 (CEOI14_carnival) C++14
0 / 100
2 ms 776 KB
#include <bits/stdc++.h>
using namespace std;

int id[150], rk[150], sr[150];
vector<int> tor;

int main() {
    int N, l, h, m, c, t = 0, i, j;
    scanf("%d", &N);
    for (i = 0; i < N; ++i) id[i] = i;
    for (i = 0; i < N; ++i) {
        assert(!i);
        printf("%d ", tor.size() + 1);
        for (j = 0; j < tor.size(); ++j) printf("%d ", tor[j] + 1);
        printf("%d\n", i + 1);
        fflush(stdout);
        scanf("%d", &c);
        if (c <= tor.size()) {
            l = 0;
            h = tor.size() - 1;
            while (l < h) {
                m = (l + h) / 2;
                printf("%d ", m + 2);
                for (j = l; j < m + 1; ++j) printf("%d ", tor[j] + 1);
                printf("%d\n", i + 1);
                fflush(stdout);
                scanf("%d", &c);
                (c <= m + 1 ? h : l) = m + (c > m + 1);
            }
            id[i] = tor[(l + h) / 2];
        } else tor.push_back(i);
    }

    printf("0 ");
    for (i = 0; i < N; ++i) {
        if (i == id[i]) sr[i] = ++t;
        printf("%d%c", sr[id[i]], i < N - 1 ? ' ' : '\n');
    }
    fflush(stdout);
    return 0;
}

Compilation message

carnival.cpp: In function 'int main()':
carnival.cpp:13:37: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<int>::size_type {aka long unsigned int}' [-Wformat=]
         printf("%d ", tor.size() + 1);
                       ~~~~~~~~~~~~~~^
carnival.cpp:14:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for (j = 0; j < tor.size(); ++j) printf("%d ", tor[j] + 1);
                     ~~^~~~~~~~~~~~
carnival.cpp:18:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         if (c <= tor.size()) {
             ~~^~~~~~~~~~~~~
carnival.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &N);
     ~~~~~^~~~~~~~~~
carnival.cpp:17:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &c);
         ~~~~~^~~~~~~~~~
carnival.cpp:27:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
                 scanf("%d", &c);
                 ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 628 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 640 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 776 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 2 ms 776 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -