Submission #1257627

#TimeUsernameProblemLanguageResultExecution timeMemory
1257627Canuc80k선물 (IOI25_souvenirs)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; std::pair<std::vector<int>, long long> transaction(long long M); ll res[201], cnt[201], tmp[201]; void buy_souvenirs(int n, long long p) { memset(res, 0x3f, sizeof res); res[0] = p; for (int i = 1; i < n; i ++) { res[i] = min({res[i], 3 * res[i - 1] / 4}); if (i != 1) res[i] = min(res[i], ceill(res[i - 2] / (ld)2)); for (int j = cnt[i] + 1; j <= i; j ++) { tmp[i] = res[i - 1] / 2; for (int k = i + 1; k < n; k ++) tmp[k] = tmp[k - 1] / 2; tmp[n - 1] = max(tmp[n - 1], 1ll); tmp[n - 2] = max(tmp[n - 2], 2ll); for (int k = n - 3; k >= i; k --) tmp[i] = max(tmp[i], tmp[i + 1] + tmp[i + 2]); // cout << "???: " << i << ' ' << res[i] << endl; auto [v, x] = transaction(res[i]); // cout << "Buy: " << res[i] << endl; for (int k = 0; k < v.size(); k ++) { cnt[v[k]] ++; if (k != 0) res[i] -= tmp[v[k]]; } res[i] -= x; // cout << "Res: " << res[i] << endl; // for (auto x: v) cout << x << ' '; cout << endl; // cout << "Rem: " << x << endl; // cout << "Tmp: " << endl; // for (int k = i; k < n; k ++) cout << i << ' ' << tmp[k] << endl; } } // for (int i = 0; i < n; i ++) cout << res[i] << ' '; cout << endl; }

Compilation message (stderr)

souvenirs.cpp: In function 'void buy_souvenirs(int, long long int)':
souvenirs.cpp:16:33: error: no matching function for call to 'min(ll&, long double)'
   16 |         if (i != 1) res[i] = min(res[i], ceill(res[i - 2] / (ld)2));
      |                              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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 souvenirs.cpp:1:
/usr/include/c++/11/bits/stl_algobase.h:230:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:230:5: note:   template argument deduction/substitution failed:
souvenirs.cpp:16:33: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long double')
   16 |         if (i != 1) res[i] = min(res[i], ceill(res[i - 2] / (ld)2));
      |                              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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 souvenirs.cpp:1:
/usr/include/c++/11/bits/stl_algobase.h:278:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algobase.h:278:5: note:   template argument deduction/substitution failed:
souvenirs.cpp:16:33: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'long double')
   16 |         if (i != 1) res[i] = min(res[i], ceill(res[i - 2] / (ld)2));
      |                              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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 souvenirs.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3449:5: note: candidate: 'template<class _Tp> constexpr _Tp std::min(std::initializer_list<_Tp>)'
 3449 |     min(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3449:5: note:   template argument deduction/substitution failed:
souvenirs.cpp:16:33: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   16 |         if (i != 1) res[i] = min(res[i], ceill(res[i - 2] / (ld)2));
      |                              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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 souvenirs.cpp:1:
/usr/include/c++/11/bits/stl_algo.h:3455:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3455 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/11/bits/stl_algo.h:3455:5: note:   template argument deduction/substitution failed:
souvenirs.cpp:16:33: note:   mismatched types 'std::initializer_list<_Tp>' and 'long long int'
   16 |         if (i != 1) res[i] = min(res[i], ceill(res[i - 2] / (ld)2));
      |                              ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~