Submission #1201620

#TimeUsernameProblemLanguageResultExecution timeMemory
1201620dibamboo23Swapping Cities (APIO20_swap)C++20
Compilation error
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.sz>1)sum=max(W[0],W[1]); return; } int getMinimumFuelCapacity(int X, int Y) { if(n==2&&m>1)return sum; return -1; }

Compilation message (stderr)

swap.cpp: In function 'void init(int, int, std::vector<int>, std::vector<int>, std::vector<int>)':
swap.cpp:13:19: error: 'class std::vector<int>' has no member named 'sz'; did you mean 'size'?
   13 |         if((int)W.sz>1)sum=max(W[0],W[1]);
      |                   ^~
      |                   size
swap.cpp:13:28: error: 'max' was not declared in this scope
   13 |         if((int)W.sz>1)sum=max(W[0],W[1]);
      |                            ^~~
swap.cpp:13:28: 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{};
      |                             ^~~