제출 #1038708

#제출 시각아이디문제언어결과실행 시간메모리
1038708vjudge1자리 배치 (IOI18_seats)C++17
컴파일 에러
0 ms0 KiB
namespace { int read_int() { int x; if (scanf("%d", &x) != 1) { fprintf(stderr, "Error while reading input\n"); exit(1); } return x; } } // namespace int main() { int H = read_int(); int W = read_int(); int Q = read_int(); std::vector<int> R(H * W), C(H * W); for (int i = 0; i < H * W; ++i) { R[i] = read_int(); C[i] = read_int(); } std::vector<int> A(Q), B(Q); for (int j = 0; j < Q; ++j) { A[j] = read_int(); B[j] = read_int(); } give_initial_chart(H, W, R, C); for (int j = 0; j < Q; ++j) { int answer = swap_seats(A[j], B[j]); printf("%d\n", answer); } return 0; }

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

seats.cpp: In function 'int {anonymous}::read_int()':
seats.cpp:5:7: error: 'scanf' was not declared in this scope
    5 |   if (scanf("%d", &x) != 1) {
      |       ^~~~~
seats.cpp:6:13: error: 'stderr' was not declared in this scope
    6 |     fprintf(stderr, "Error while reading input\n");
      |             ^~~~~~
seats.cpp:1:1: note: 'stderr' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?
  +++ |+#include <cstdio>
    1 | namespace {
seats.cpp:6:5: error: 'fprintf' was not declared in this scope
    6 |     fprintf(stderr, "Error while reading input\n");
      |     ^~~~~~~
seats.cpp:7:5: error: 'exit' was not declared in this scope
    7 |     exit(1);
      |     ^~~~
seats.cpp: In function 'int main()':
seats.cpp:18:8: error: 'vector' is not a member of 'std'
   18 |   std::vector<int> R(H * W), C(H * W);
      |        ^~~~~~
seats.cpp:1:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
  +++ |+#include <vector>
    1 | namespace {
seats.cpp:18:15: error: expected primary-expression before 'int'
   18 |   std::vector<int> R(H * W), C(H * W);
      |               ^~~
seats.cpp:20:5: error: 'R' was not declared in this scope
   20 |     R[i] = read_int();
      |     ^
seats.cpp:21:5: error: 'C' was not declared in this scope
   21 |     C[i] = read_int();
      |     ^
seats.cpp:23:8: error: 'vector' is not a member of 'std'
   23 |   std::vector<int> A(Q), B(Q);
      |        ^~~~~~
seats.cpp:23:8: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
seats.cpp:23:15: error: expected primary-expression before 'int'
   23 |   std::vector<int> A(Q), B(Q);
      |               ^~~
seats.cpp:25:5: error: 'A' was not declared in this scope
   25 |     A[j] = read_int();
      |     ^
seats.cpp:26:5: error: 'B' was not declared in this scope
   26 |     B[j] = read_int();
      |     ^
seats.cpp:29:28: error: 'R' was not declared in this scope
   29 |   give_initial_chart(H, W, R, C);
      |                            ^
seats.cpp:29:31: error: 'C' was not declared in this scope
   29 |   give_initial_chart(H, W, R, C);
      |                               ^
seats.cpp:29:3: error: 'give_initial_chart' was not declared in this scope
   29 |   give_initial_chart(H, W, R, C);
      |   ^~~~~~~~~~~~~~~~~~
seats.cpp:31:29: error: 'A' was not declared in this scope
   31 |     int answer = swap_seats(A[j], B[j]);
      |                             ^
seats.cpp:31:35: error: 'B' was not declared in this scope
   31 |     int answer = swap_seats(A[j], B[j]);
      |                                   ^
seats.cpp:31:18: error: 'swap_seats' was not declared in this scope
   31 |     int answer = swap_seats(A[j], B[j]);
      |                  ^~~~~~~~~~
seats.cpp:32:5: error: 'printf' was not declared in this scope
   32 |     printf("%d\n", answer);
      |     ^~~~~~
seats.cpp:32:5: note: 'printf' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?