제출 #754184

#제출 시각아이디문제언어결과실행 시간메모리
754184nicksms마상시합 토너먼트 (IOI12_tournament)C++17
컴파일 에러
0 ms0 KiB
#include <bits/extc++.h> int ans[100001],cl[100000],cr[100000]; int GetBestPosition(int N, int C, int R, int *K, int *S, int *E) { struct p {int x,y;}; __gnu_cxx::rope<p> g; int cnt = 0; for (int i = 0; i < N-1; i++) if (K[i] > R) { cl[i+1]++; cr[i]++; cnt++; } for (int i = 1; i < N; i++) cl[i]+=cl[i-1]; for (int i = N-2; i >= 0; i--) cr[i]+=cr[i+1]; for (int i = 0; i < N; i++) g.push_back({i,i}); for (int i = 0; i < C; i++) { int l=g[S[i]].x,r=g[E[i]].y; g.erase(S[i],E[i]-S[i]+1); g.insert(S[i],{l,r}); if (cl[l]+cr[r]==cnt) ans[l]++,ans[r+1]--; } int a = ans[0]; for (int i = 1; i <= N; i++) a=max(a,ans[i] += ans[i-1]); return a; }

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

tournament.cpp: In function 'int GetBestPosition(int, int, int, int*, int*, int*)':
tournament.cpp:23:34: error: 'max' was not declared in this scope; did you mean 'std::max'?
   23 |   for (int i = 1; i <= N; i++) a=max(a,ans[i] += ans[i-1]);
      |                                  ^~~
      |                                  std::max
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/extc++.h:32,
                 from tournament.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3486:5: note: 'std::max' declared here
 3486 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~