제출 #776552

#제출 시각아이디문제언어결과실행 시간메모리
776552SanguineChameleon드문 곤충 (IOI22_insects)C++17
컴파일 에러
0 ms0 KiB
#include "insects.h" #include <bits/stdc++.h> using namespace std; const int maxN = 2e3 + 20; int order[maxN]; int pref[maxN]; vector<int> diff; vector<int> cnt; mt19937 gen(chrono::steady_clock::now().time_since_epoch()); void solve(int lt, int rt, vector<int> rem, bool on) { if (lt == rt) { cnt[lt] += (int)rem.size(); return; } if (rem.empty()) { return; } int mt = (lt + rt) / 2; if (on) { for (int i = mt + 1; i <= rt; i++) { move_outside(diff[i]); } vector<int> left_rem; vector<int> right_rem; for (auto x: rem) { if (pref[x] <= mt) { left_rem.push_back(x); continue; } move_inside(x); if (press_button() == 2) { left_rem.push_back(x); } else { right_rem.push_back(x); } move_outside(x); } solve(lt, mt, left_rem, true); solve(mt + 1, rt, right_rem, false); } else { for (int i = mt + 1; i <= rt; i++) { move_inside(diff[i]); } vector<int> left_rem; vector<int> right_rem; for (auto x: rem) { if (pref[x] <= mt) { left_rem.push_back(x); continue; } move_inside(x); if (press_button() == 2) { right_rem.push_back(x); } else { left_rem.push_back(x); } move_outside(x); } solve(lt, mt, left_rem, false); solve(mt + 1, rt, right_rem, true); } } int min_cardinality(int N) { for (int i = 0; i < N; i++) { order[i] = i; } shuffle(order, order + N, gen); diff.push_back(order[0]); move_inside(order[0]); vector<int> rem; for (int i = 1; i < N; i++) { move_inside(order[i]); if (press_button() == 1) { diff.push_back(order[i]); } else { pref[order[i]] = (int)diff.size() - 1; rem.push_back(order[i]); move_outside(order[i]); } } cnt.resize(diff.size(), 1); solve(0, (int)diff.size() - 1, rem, true); int res = N + 1; for (auto x: cnt) { res = min(res, x); } return res; }

컴파일 시 표준 에러 (stderr) 메시지

insects.cpp:10:59: error: no matching function for call to 'std::mersenne_twister_engine<long unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253>::mersenne_twister_engine(std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long int, std::ratio<1, 1000000000> > >::duration)'
   10 | mt19937 gen(chrono::steady_clock::now().time_since_epoch());
      |                                                           ^
In file included from /usr/include/c++/10/random:49,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:108,
                 from insects.cpp:2:
/usr/include/c++/10/bits/random.h:532:9: note: candidate: 'template<class _Sseq, class> std::mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::mersenne_twister_engine(_Sseq&) [with _Sseq = _Sseq; <template-parameter-2-2> = <template-parameter-1-2>; _UIntType = long unsigned int; long unsigned int __w = 32; long unsigned int __n = 624; long unsigned int __m = 397; long unsigned int __r = 31; _UIntType __a = 2567483615; long unsigned int __u = 11; _UIntType __d = 4294967295; long unsigned int __s = 7; _UIntType __b = 2636928640; long unsigned int __t = 15; _UIntType __c = 4022730752; long unsigned int __l = 18; _UIntType __f = 1812433253]'
  532 |         mersenne_twister_engine(_Sseq& __q)
      |         ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/random.h:532:9: note:   template argument deduction/substitution failed:
/usr/include/c++/10/bits/random.h: In substitution of 'template<class _UIntType, long unsigned int __w, long unsigned int __n, long unsigned int __m, long unsigned int __r, _UIntType __a, long unsigned int __u, _UIntType __d, long unsigned int __s, _UIntType __b, long unsigned int __t, _UIntType __c, long unsigned int __l, _UIntType __f> template<class _Sseq> using _If_seed_seq = typename std::enable_if<std::__detail::__is_seed_seq<_Sseq, std::mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>, _UIntType>::value>::type [with _Sseq = std::chrono::duration<long int, std::ratio<1, 1000000000> >; _UIntType = long unsigned int; long unsigned int __w = 32; long unsigned int __n = 624; long unsigned int __m = 397; long unsigned int __r = 31; _UIntType __a = 2567483615; long unsigned int __u = 11; _UIntType __d = 4294967295; long unsigned int __s = 7; _UIntType __b = 2636928640; long unsigned int __t = 15; _UIntType __c = 4022730752; long unsigned int __l = 18; _UIntType __f = 1812433253]':
/usr/include/c++/10/bits/random.h:530:32:   required from here
/usr/include/c++/10/bits/random.h:493:8: error: 'struct std::chrono::duration<long int, std::ratio<1, 1000000000> >' has no member named 'generate'
  493 |  using _If_seed_seq = typename enable_if<__detail::__is_seed_seq<
      |        ^~~~~~~~~~~~
/usr/include/c++/10/bits/random.h:521:7: note: candidate: 'std::mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::mersenne_twister_engine(std::mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type) [with _UIntType = long unsigned int; long unsigned int __w = 32; long unsigned int __n = 624; long unsigned int __m = 397; long unsigned int __r = 31; _UIntType __a = 2567483615; long unsigned int __u = 11; _UIntType __d = 4294967295; long unsigned int __s = 7; _UIntType __b = 2636928640; long unsigned int __t = 15; _UIntType __c = 4022730752; long unsigned int __l = 18; _UIntType __f = 1812433253; std::mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type = long unsigned int]'
  521 |       mersenne_twister_engine(result_type __sd)
      |       ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/random.h:521:43: note:   no known conversion for argument 1 from 'std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long int, std::ratio<1, 1000000000> > >::duration' {aka 'std::chrono::duration<long int, std::ratio<1, 1000000000> >'} to 'std::mersenne_twister_engine<long unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253>::result_type' {aka 'long unsigned int'}
  521 |       mersenne_twister_engine(result_type __sd)
      |                               ~~~~~~~~~~~~^~~~
/usr/include/c++/10/bits/random.h:518:7: note: candidate: 'std::mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::mersenne_twister_engine() [with _UIntType = long unsigned int; long unsigned int __w = 32; long unsigned int __n = 624; long unsigned int __m = 397; long unsigned int __r = 31; _UIntType __a = 2567483615; long unsigned int __u = 11; _UIntType __d = 4294967295; long unsigned int __s = 7; _UIntType __b = 2636928640; long unsigned int __t = 15; _UIntType __c = 4022730752; long unsigned int __l = 18; _UIntType __f = 1812433253]'
  518 |       mersenne_twister_engine() : mersenne_twister_engine(default_seed) { }
      |       ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/random.h:518:7: note:   candidate expects 0 arguments, 1 provided
/usr/include/c++/10/bits/random.h:463:11: note: candidate: 'constexpr std::mersenne_twister_engine<long unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253>::mersenne_twister_engine(const std::mersenne_twister_engine<long unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253>&)'
  463 |     class mersenne_twister_engine
      |           ^~~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/random.h:463:11: note:   no known conversion for argument 1 from 'std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long int, std::ratio<1, 1000000000> > >::duration' {aka 'std::chrono::duration<long int, std::ratio<1, 1000000000> >'} to 'const std::mersenne_twister_engine<long unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253>&'
/usr/include/c++/10/bits/random.h:463:11: note: candidate: 'constexpr std::mersenne_twister_engine<long unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253>::mersenne_twister_engine(std::mersenne_twister_engine<long unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253>&&)'
/usr/include/c++/10/bits/random.h:463:11: note:   no known conversion for argument 1 from 'std::chrono::time_point<std::chrono::_V2::steady_clock, std::chrono::duration<long int, std::ratio<1, 1000000000> > >::duration' {aka 'std::chrono::duration<long int, std::ratio<1, 1000000000> >'} to 'std::mersenne_twister_engine<long unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253>&&'