제출 #1201621

#제출 시각아이디문제언어결과실행 시간메모리
1201621dibamboo23자매 도시 (APIO20_swap)C++20
컴파일 에러
0 ms0 KiB
#include "swap.h" #include <bits/stdc++.h> int n,m; int sum=0; void init(int N, int M,std::vector<int> U, std::vector<int> V, std::vector<int> W){ n=N; m=M; sort(W.begin(),W.end()); if((int)W.size()>1)sum=max(W[0],W[1]); return; } int getMinimumFuelCapacity(int X, int Y) { if(n==2&&m>1)return sum; return -1; }

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

swap.cpp: In function 'void init(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
swap.cpp:13:32: error: 'max' was not declared in this scope
   13 |         if((int)W.size()>1)sum=max(W[0],W[1]);
      |                                ^~~
swap.cpp:13:32: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:62,
                 from swap.h:1,
                 from swap.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note:   'std::max'
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
In file included from /usr/include/c++/11/algorithm:64,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from swap.cpp:3:
/usr/include/c++/11/bits/ranges_algo.h:3011:29: note:   'std::ranges::max'
 3011 |   inline constexpr __max_fn max{};
      |                             ^~~