제출 #375301

#제출 시각아이디문제언어결과실행 시간메모리
375301astoriaSwapping Cities (APIO20_swap)C++14
컴파일 에러
0 ms0 KiB
#include "bits/stdc++.h" #include "swap.h" #include <vector> int mx; bool isM; void init(int N, int M, std::vector<int> U, std::vector<int> V, std::vector<int> W) { mx=0; for(int i : W){ mx=max(mx,i); } isM=0; if(N==M) isM=1; } int getMinimumFuelCapacity(int X, int Y) { if(isM) return mx; else return -1; }

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

swap.cpp: In function 'void init(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
swap.cpp:12:6: error: 'max' was not declared in this scope; did you mean 'std::max'?
   12 |   mx=max(mx,i);
      |      ^~~
      |      std::max
In file included from /usr/include/c++/9/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from swap.cpp:1:
/usr/include/c++/9/bits/stl_algo.h:3462:5: note: 'std::max' declared here
 3462 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~