제출 #384561

#제출 시각아이디문제언어결과실행 시간메모리
384561morato팀들 (IOI15_teams)C++17
컴파일 에러
0 ms0 KiB
#include "teams.h" #include <bits/stdc++.h> const int MAXN = 1e5 + 5; int n; pair<int, int> segment[MAXN]; void init(int N, int A[], int B[]) { n = N; for (int i = 0; i < n; i++) { segment[i].first = A[i]; segment[i].second = B[i]; } sort(segment.begin(), segment.end()); } int can(int M, int K[]) { sort(K, K + M); for (int i = 0, j = 0; i < M; i++) { int cnt = 0; for (; j < n; j++) { if (segment[j].first <= K[i] && K[i] <= segment[j].second) { cnt++; } if (cnt == K[i]) break; } if (cnt < K[i]) return 0; } return 1; }

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

teams.cpp:8:1: error: 'pair' does not name a type
    8 | pair<int, int> segment[MAXN];
      | ^~~~
teams.cpp: In function 'void init(int, int*, int*)':
teams.cpp:13:3: error: 'segment' was not declared in this scope
   13 |   segment[i].first = A[i];
      |   ^~~~~~~
teams.cpp:16:7: error: 'segment' was not declared in this scope
   16 |  sort(segment.begin(), segment.end());
      |       ^~~~~~~
teams.cpp:16:2: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   16 |  sort(segment.begin(), segment.end());
      |  ^~~~
      |  std::sort
In file included from /usr/include/c++/9/algorithm:71,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from teams.cpp:2:
/usr/include/c++/9/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
teams.cpp: In function 'int can(int, int*)':
teams.cpp:20:2: error: 'sort' was not declared in this scope; did you mean 'std::sort'?
   20 |  sort(K, K + M);
      |  ^~~~
      |  std::sort
In file included from /usr/include/c++/9/algorithm:71,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from teams.cpp:2:
/usr/include/c++/9/pstl/glue_algorithm_defs.h:296:1: note: 'std::sort' declared here
  296 | sort(_ExecutionPolicy&& __exec, _RandomAccessIterator __first, _RandomAccessIterator __last);
      | ^~~~
teams.cpp:24:8: error: 'segment' was not declared in this scope
   24 |    if (segment[j].first <= K[i] && K[i] <= segment[j].second) {
      |        ^~~~~~~