Submission #1135935

#TimeUsernameProblemLanguageResultExecution timeMemory
1135935MateiKing80Watering can (POI13_kon)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; const int NMAX = 300000, B = 700, LBOZO = 100000; ll N, K, t[NMAX + 5], zeros[NMAX + 5], ans[NMAX + 5]; signed mp[332][LBOZO + 5]; void inicjuj(signed n, signed k, signed *D) { for(int i = 0; i < n; i ++) t[i] = D[i]; N = n, K = k; for(int i = 0; i < n; i ++) { if(K >= t[i] && K - t[i] <= LBOZO) mp[i / B][-(K - t[i]) + LBOZO] ++; if(t[i] >= K) ans[i / B] ++; } } void podlej(signed a, signed b) { int from = a/B, to = (b / B); for(int i = from; i <= to; i ++) { if(a <= i * B && b >= (i + 1) * B - 1) { zeros[i]++; ans[i] += mp[i][LBOZO - zeros[i]]; } else { ans[i] = 0; for(int j = i * B; j / B == i && j < N; j ++) { if(K >= t[j] && K - t[j] <= LBOZO) mp[i][-(K - t[j]) + LBOZO] --; t[j] += zeros[i]; if(j >= a && j <= b) t[j] ++; if(K >= t[j] && K - t[j] <= LBOZO) mp[i][- (K - t[j]) + LBOZO] ++; if(t[j] >= K) ans[i]++; } zeros[i] = 0; } } } signed dojrzale(signed a, signed b) { int rasp = 0; int from = a / B, to = (b / B); for(int i = from; i <= to; i ++) { if(a <= i * B && b >= (i + 1) * B - 1) rasp += ans[i]; else { for(int j = max(1ll * a, i * B); j / B == i && j <= b; j ++) rasp += (t[j] + zeros[i] >= K); } } return rasp; }

Compilation message (stderr)

kon.cpp: In function 'int dojrzale(int, int)':
kon.cpp:65:28: error: no matching function for call to 'max(long long int, int)'
   65 |             for(int j = max(1ll * a, i * B); j / B == i && j <= b; j ++)
      |                         ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from kon.cpp:1:
/usr/include/c++/11/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
kon.cpp:65:28: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   65 |             for(int j = max(1ll * a, i * B); j / B == i && j <= b; j ++)
      |                         ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/bits/specfun.h:45,
                 from /usr/include/c++/11/cmath:1935,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41,
                 from kon.cpp:1:
/usr/include/c++/11/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
kon.cpp:65:28: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   65 |             for(int j = max(1ll * a, i * B); j / B == i && j <= b; j ++)
      |                         ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from kon.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3461:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(std::initializer_list<_Tp>)'
 3461 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3461:5: note:   template argument deduction/substitution failed:
kon.cpp:65:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   65 |             for(int j = max(1ll * a, i * B); j / B == i && j <= b; j ++)
      |                         ~~~^~~~~~~~~~~~~~~~
In file included from /usr/include/c++/11/string:52,
                 from /usr/include/c++/11/bits/locale_classes.h:40,
                 from /usr/include/c++/11/bits/ios_base.h:41,
                 from /usr/include/c++/11/ios:42,
                 from /usr/include/c++/11/istream:38,
                 from /usr/include/c++/11/sstream:38,
                 from /usr/include/c++/11/complex:45,
                 from /usr/include/c++/11/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:54,
                 from kon.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(std::initializer_list<_Tp>, _Compare)'
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3467:5: note:   template argument deduction/substitution failed:
kon.cpp:65:28: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   65 |             for(int j = max(1ll * a, i * B); j / B == i && j <= b; j ++)
      |                         ~~~^~~~~~~~~~~~~~~~