제출 #48125

#제출 시각아이디문제언어결과실행 시간메모리
48125jeffCarnival (CEOI14_carnival)C++14
0 / 100
3 ms452 KiB
#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) { 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; }

컴파일 시 표준 에러 (stderr) 메시지

carnival.cpp: In function 'int main()':
carnival.cpp:12: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:13: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:17: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:16:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &c);
         ~~~~~^~~~~~~~~~
carnival.cpp:26:22: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
                 scanf("%d", &c);
                 ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...