Submission #1187745

#TimeUsernameProblemLanguageResultExecution timeMemory
1187745Mamikonm1Unscrambling a Messy Bug (IOI16_messy)C++20
Compilation error
0 ms0 KiB
#include <iostream> #include<vector> #include<cmath> #include<set> #include<algorithm> #include<random> #include "messy.h" using namespace std; mt19937 rd(time(nullptr)); void comp(string& a, vector<int>& f) { string b = string(a.size(), '0'); for (int i = 0; i < a.size(); ++i) b[i] = a[f[i]]; a = b; } vector<int> restore_permutation(int n, int w, int r) { vector<int>f(n), ans(n); vector<string>s(n, string(n, '0')); for (int i = 0; i < n; ++i) { f[i] = i; for (int j = 0; j <= i; ++j) s[i][j] = '1'; } shuffle(begin(f), end(f), rd()); for (int i = 0; i < n; ++i) { comp(s[i], f); add_element(s[i]); } compile_set(); int ind; string t = string(n, '0'), g; g = t; for (int i = 0; i < n; ++i) { ind = 0; for (int j = 0; j < n; ++j) { if (g[j] == '0' and s[i][j] == '1') { ind = j; } } g[ind] = '1'; for (int j = 0; j < n; ++j) { if (t[j] == '0') { t[j] = '1'; if (check_element(t)) { ans[j] = ind; break; } t[j] = '0'; } } } return ans; }

Compilation message (stderr)

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/ostream:38,
                 from /usr/include/c++/11/iostream:39,
                 from messy.cpp:1:
/usr/include/c++/11/bits/stl_algo.h: In instantiation of 'void std::shuffle(_RAIter, _RAIter, _UGenerator&&) [with _RAIter = __gnu_cxx::__normal_iterator<int*, std::vector<int> >; _UGenerator = long unsigned int]':
messy.cpp:25:12:   required from here
/usr/include/c++/11/bits/stl_algo.h:3750:9: error: 'std::remove_reference<long unsigned int>::type' {aka 'long unsigned int'} is not a class, struct, or union type
 3750 |         __uc_type;
      |         ^~~~~~~~~
/usr/include/c++/11/bits/stl_algo.h:3778:44: error: 'std::remove_reference<long unsigned int>::type' {aka 'long unsigned int'} is not a class, struct, or union type
 3778 |           const pair<__uc_type, __uc_type> __pospos =
      |                                            ^~~~~~~~
/usr/include/c++/11/bits/stl_algo.h:3778:44: error: 'std::remove_reference<long unsigned int>::type' {aka 'long unsigned int'} is not a class, struct, or union type
messy.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
messy_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~