Submission #1305172

#TimeUsernameProblemLanguageResultExecution timeMemory
1305172mary-_-bogdanovaBoxes with souvenirs (IOI15_boxes)C++20
Compilation error
0 ms0 KiB
#include "boxes.h"
#include <bits/stdc++.h>
using ll = long long;

ll delivery(int N, int K, int L, int p[]) {
    if (K == 1) {
        ll ans = 0;
        for (ll i = 0; i < N; i++) {
            ans += min(p[i], L - p[i]);
        }
        return ans;
    }
    return 0;
}

Compilation message (stderr)

boxes.cpp: In function 'll delivery(int, int, int, int*)':
boxes.cpp:9:20: error: 'min' was not declared in this scope
    9 |             ans += min(p[i], L - p[i]);
      |                    ^~~
boxes.cpp:9:20: note: suggested alternatives:
In file included from /usr/include/c++/13/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51,
                 from boxes.cpp:2:
/usr/include/c++/13/bits/stl_algo.h:5785:5: note:   'std::min'
 5785 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
In file included from /usr/include/c++/13/bits/ranges_algo.h:39,
                 from /usr/include/c++/13/algorithm:63:
/usr/include/c++/13/bits/ranges_util.h:738:29: note:   'std::ranges::min'
  738 |   inline constexpr __min_fn min{};
      |                             ^~~