제출 #434531

#제출 시각아이디문제언어결과실행 시간메모리
434531medmdg전선 연결 (IOI17_wiring)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #include "wiring.h" #define ll long long long long min_total_length(std::vector<int> r, std::vector<int> b) { ll c=0; ll x=0,y=10000000000; for(int i=0;i<r.size();i++){ x=max(x,r[i]); c-=r[i]; } c-=max(0,(b.size()-r.size())*x); for(int i=0;i<b.size();i++){ y=min(x,b[i]); c+=b[i]; } c+=max(0,(r.size()-b.size())*y); return c; }

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

wiring.cpp: In function 'long long int min_total_length(std::vector<int>, std::vector<int>)':
wiring.cpp:7:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    7 |         for(int i=0;i<r.size();i++){
      |                     ~^~~~~~~~~
wiring.cpp:8:15: error: 'max' was not declared in this scope; did you mean 'std::max'?
    8 |             x=max(x,r[i]);
      |               ^~~
      |               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 wiring.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)
      |     ^~~
wiring.cpp:11:12: error: 'max' was not declared in this scope; did you mean 'std::max'?
   11 |         c-=max(0,(b.size()-r.size())*x);
      |            ^~~
      |            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 wiring.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)
      |     ^~~
wiring.cpp:12:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |         for(int i=0;i<b.size();i++){
      |                     ~^~~~~~~~~
wiring.cpp:13:15: error: 'min' was not declared in this scope; did you mean 'std::min'?
   13 |             y=min(x,b[i]);
      |               ^~~
      |               std::min
In file included from /usr/include/c++/10/algorithm:62,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from wiring.cpp:1:
/usr/include/c++/10/bits/stl_algo.h:3474:5: note: 'std::min' declared here
 3474 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~