제출 #1038709

#제출 시각아이디문제언어결과실행 시간메모리
1038709vjudge1Werewolf (IOI18_werewolf)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 N = read_int(); int M = read_int(); int Q = read_int(); std::vector<int> X(M), Y(M), S(Q), E(Q), L(Q), R(Q); for (int j = 0; j < M; ++j) { X[j] = read_int(); Y[j] = read_int(); } for (int i = 0; i < Q; ++i) { S[i] = read_int(); E[i] = read_int(); L[i] = read_int(); R[i] = read_int(); } std::vector<int> A = check_validity(N, X, Y, S, E, L, R); for (size_t i = 0; i < A.size(); ++i) { printf("%d\n", A[i]); } return 0; }

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

werewolf.cpp: In function 'int {anonymous}::read_int()':
werewolf.cpp:5:7: error: 'scanf' was not declared in this scope
    5 |   if (scanf("%d", &x) != 1) {
      |       ^~~~~
werewolf.cpp:6:13: error: 'stderr' was not declared in this scope
    6 |     fprintf(stderr, "Error while reading input\n");
      |             ^~~~~~
werewolf.cpp:1:1: note: 'stderr' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?
  +++ |+#include <cstdio>
    1 | namespace {
werewolf.cpp:6:5: error: 'fprintf' was not declared in this scope
    6 |     fprintf(stderr, "Error while reading input\n");
      |     ^~~~~~~
werewolf.cpp:7:5: error: 'exit' was not declared in this scope
    7 |     exit(1);
      |     ^~~~
werewolf.cpp: In function 'int main()':
werewolf.cpp:18:8: error: 'vector' is not a member of 'std'
   18 |   std::vector<int> X(M), Y(M), S(Q), E(Q), L(Q), R(Q);
      |        ^~~~~~
werewolf.cpp:1:1: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
  +++ |+#include <vector>
    1 | namespace {
werewolf.cpp:18:15: error: expected primary-expression before 'int'
   18 |   std::vector<int> X(M), Y(M), S(Q), E(Q), L(Q), R(Q);
      |               ^~~
werewolf.cpp:20:5: error: 'X' was not declared in this scope
   20 |     X[j] = read_int();
      |     ^
werewolf.cpp:21:5: error: 'Y' was not declared in this scope
   21 |     Y[j] = read_int();
      |     ^
werewolf.cpp:24:5: error: 'S' was not declared in this scope
   24 |     S[i] = read_int();
      |     ^
werewolf.cpp:25:5: error: 'E' was not declared in this scope
   25 |     E[i] = read_int();
      |     ^
werewolf.cpp:26:5: error: 'L' was not declared in this scope
   26 |     L[i] = read_int();
      |     ^
werewolf.cpp:27:5: error: 'R' was not declared in this scope
   27 |     R[i] = read_int();
      |     ^
werewolf.cpp:30:8: error: 'vector' is not a member of 'std'
   30 |   std::vector<int> A = check_validity(N, X, Y, S, E, L, R);
      |        ^~~~~~
werewolf.cpp:30:8: note: 'std::vector' is defined in header '<vector>'; did you forget to '#include <vector>'?
werewolf.cpp:30:15: error: expected primary-expression before 'int'
   30 |   std::vector<int> A = check_validity(N, X, Y, S, E, L, R);
      |               ^~~
werewolf.cpp:31:8: error: 'size_t' was not declared in this scope
   31 |   for (size_t i = 0; i < A.size(); ++i) {
      |        ^~~~~~
werewolf.cpp:1:1: note: 'size_t' is defined in header '<cstddef>'; did you forget to '#include <cstddef>'?
  +++ |+#include <cstddef>
    1 | namespace {
werewolf.cpp:31:22: error: 'i' was not declared in this scope
   31 |   for (size_t i = 0; i < A.size(); ++i) {
      |                      ^
werewolf.cpp:31:26: error: 'A' was not declared in this scope
   31 |   for (size_t i = 0; i < A.size(); ++i) {
      |                          ^
werewolf.cpp:32:5: error: 'printf' was not declared in this scope
   32 |     printf("%d\n", A[i]);
      |     ^~~~~~
werewolf.cpp:32:5: note: 'printf' is defined in header '<cstdio>'; did you forget to '#include <cstdio>'?
werewolf.cpp:15:7: warning: unused variable 'N' [-Wunused-variable]
   15 |   int N = read_int();
      |       ^