Submission #992618

#TimeUsernameProblemLanguageResultExecution timeMemory
992618amin_2008Art Collections (BOI22_art)C++17
Compilation error
0 ms0 KiB
#include <iostream> #include <fstream> #include <cstdio> #include <queue> #include <vector> #include <algorithm> #include <iomanip> #include <map> #include <cassert> #include <unordered_map> #include <set> #include <stack> #include <cstring> #include <cmath> #include <bitset> #include <random> #include <numeric> #include <cstdlib> #include "art.h" using namespace std; // // --- Sample implementation for the task art --- // // To compile this program with the sample grader, place: // art.h art_sample.cpp sample_grader.cpp // in a single folder, then open the terminal in this directory (right-click onto an empty spot in the directory, // left click on "Open in terminal") and enter e.g.: // g++ -std=c++17 art_sample.cpp sample_grader.cpp // in this folder. This will create a file a.out in the current directory which you can execute from the terminal // as ./a.out // See task statement or sample_grader.cpp for the input specification // mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); void solve(int N) { vector<int> res; for(int i = 1; i <= N; i++) res.push_back(i); do { if (!publish(res)) { answer(res); return; } } while (random_shuffle(res.begin(), res.end(), rng)); }

Compilation message (stderr)

art.cpp:33:13: error: 'chrono' has not been declared
   33 | mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
      |             ^~~~~~
art.cpp: In function 'void solve(int)':
art.cpp:47:26: error: could not convert 'std::random_shuffle<__gnu_cxx::__normal_iterator<int*, std::vector<int> >, std::mersenne_twister_engine<long unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253>&>(res.std::vector<int>::begin(), res.std::vector<int>::end(), rng)' from 'void' to 'bool'
   47 |     while (random_shuffle(res.begin(), res.end(), rng));
      |            ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                          |
      |                          void
In file included from /usr/include/c++/10/algorithm:62,
                 from art.cpp:6:
/usr/include/c++/10/bits/stl_algo.h: In instantiation of 'void std::random_shuffle(_RAIter, _RAIter, _Generator&&) [with _RAIter = __gnu_cxx::__normal_iterator<int*, std::vector<int> >; _Generator = std::mersenne_twister_engine<long unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253>&]':
art.cpp:47:54:   required from here
/usr/include/c++/10/bits/stl_algo.h:4636:48: error: no match for call to '(std::mersenne_twister_engine<long unsigned int, 32, 624, 397, 31, 2567483615, 11, 4294967295, 7, 2636928640, 15, 4022730752, 18, 1812433253>) (__gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type)'
 4636 |    _RandomAccessIterator __j = __first + __rand((__i - __first) + 1);
      |                                          ~~~~~~^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/10/random:49,
                 from art.cpp:16:
/usr/include/c++/10/bits/random.h:563:7: note: candidate: 'std::mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::result_type std::mersenne_twister_engine<_UIntType, __w, __n, __m, __r, __a, __u, __d, __s, __b, __t, __c, __l, __f>::operator()() [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]'
  563 |       operator()();
      |       ^~~~~~~~
/usr/include/c++/10/bits/random.h:563:7: note:   candidate expects 0 arguments, 1 provided
interface.cpp: In function 'int publish(std::vector<int>)':
interface.cpp:20:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~
interface.cpp: In function 'void answer(std::vector<int>)':
interface.cpp:36:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~