Submission #434531

#TimeUsernameProblemLanguageResultExecution timeMemory
434531medmdgWiring (IOI17_wiring)C++14
Compilation error
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; }

Compilation message (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)
      |     ^~~