Submission #1251727

#TimeUsernameProblemLanguageResultExecution timeMemory
1251727LouaiZahranTriple Peaks (IOI25_triples)C++20
Compilation error
0 ms0 KiB
#include "triples.h" #include <algorithm> long long count_triples(std::vector<int> H) { long long ans = 0; int n = H.size(); for(int i=0; i<n; i++){ for(int j=i+1; j<i+11; j++){ for(int k=j+1; k<min(j+11, n); k++){ int dij = j - i, djk = k - j, dik = k - i; if(H[i] == dij && ((H[j] == djk && H[k] == dik) || (H[k] == djk && H[j] == dik))) ans++; else if(H[j] == dij && ((H[i] == djk && H[k] == dik) || (H[k] == djk && H[i] == dik))) ans++; else if(H[k] == dij && ((H[i] == djk && H[j] == dik) || (H[j] == djk && H[i] == dik))) ans++; } } } return ans; } std::vector<int> construct_range(int M, int K) { return {1, 1, 1}; }

Compilation message (stderr)

triples.cpp: In function 'long long int count_triples(std::vector<int>)':
triples.cpp:10:24: error: 'min' was not declared in this scope
   10 |       for(int k=j+1; k<min(j+11, n); k++){
      |                        ^~~
triples.cpp:10:24: note: suggested alternatives:
In file included from /usr/include/c++/11/vector:62,
                 from triples.h:1,
                 from triples.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3455:5: note:   'std::min'
 3455 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
In file included from /usr/include/c++/11/algorithm:64,
                 from triples.cpp:2:
/usr/include/c++/11/bits/ranges_algo.h:2957:29: note:   'std::ranges::min'
 2957 |   inline constexpr __min_fn min{};
      |                             ^~~