Submission #553338

#TimeUsernameProblemLanguageResultExecution timeMemory
553338fcmalkcinUnscrambling a Messy Bug (IOI16_messy)C++17
Compilation error
0 ms0 KiB
//#include "gap.h" #include<bits/stdc++.h> using namespace std; #define ll int #define pll pair<ll,ll> #define ff first #define ss second //#define endl "\n" #define pb push_back #define F(i,a,b) for(ll i=a;i<=b;i++) const ll maxn=3e5+100; const ll base=3e18; const ll mod= 1e9+7 ; mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); ll n; void dosth(ll l,ll r) { if (l==r) return ; ll mid=(l+r)/2; for (int t=l;t<=mid;t++) { string p; for (int i=1;i<l;i++) p.pb('1'); for (int i=l;i<=r;i++) { if (t==i) p.pb('1'); else p.pb('0'); } for (int i=r+1;i<=n;i++) p.pb('1'); add_element(p); } dosth(l,mid); dosth(mid+1,r); } ll res[maxn]; void dosth1(ll l,ll r,vector<ll> vt) { if (l==r) { res[vt[0]]=l; return ; } vector<bool> dd(n+3,0); for (auto to:vt) { dd[to]=1; } vector<ll> vt1; vector<ll> vt2; for (int i=0;i<vt.size();i++) { ll x=vt[i]; string p; for (int i=1;i<=n;i++) { if (dd[i]) { if (i==x) { p.pb('1'); } else { p.pb('0'); } } else { p.pb('1'); } } if (check_element(p)) { vt1.pb(p); } else { vt2.pb(p); } } dosth1(l,mid,vt1); dosth1(mid+1,r,vt2); } vector<ll> restore_permutation(int n1, int w, int r) { n=n1; dosth(1,n); compile_set(); vector<ll> vt; for (int i=1;i<=n;i++) vt.pb(i); dosth1(1,n,vt); vector<ll> ans; for (int i=1;i<=n;i++) ans.pb(p[i]-1); return ans; } /*int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if (fopen("t.inp","r")) { freopen("test.inp","r",stdin); freopen("test.out","w",stdout); } }*/

Compilation message (stderr)

messy.cpp:15:15: warning: overflow in conversion from 'double' to 'int' changes value from '3.0e+18' to '2147483647' [-Woverflow]
   15 | const ll base=3e18;
      |               ^~~~
messy.cpp: In function 'void dosth(int, int)':
messy.cpp:35:9: error: 'add_element' was not declared in this scope
   35 |         add_element(p);
      |         ^~~~~~~~~~~
messy.cpp: In function 'void dosth1(int, int, std::vector<int>)':
messy.cpp:55:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |    for (int i=0;i<vt.size();i++)
      |                 ~^~~~~~~~~~
messy.cpp:77:12: error: 'check_element' was not declared in this scope
   77 |        if (check_element(p))
      |            ^~~~~~~~~~~~~
messy.cpp:79:20: error: no matching function for call to 'std::vector<int>::push_back(std::string&)'
   79 |            vt1.pb(p);
      |                    ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from messy.cpp:3:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const value_type&' {aka 'const int&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::vector<int>::value_type&&' {aka 'int&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
messy.cpp:83:20: error: no matching function for call to 'std::vector<int>::push_back(std::string&)'
   83 |            vt2.pb(p);
      |                    ^
In file included from /usr/include/c++/10/vector:67,
                 from /usr/include/c++/10/functional:62,
                 from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/10/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:65,
                 from messy.cpp:3:
/usr/include/c++/10/bits/stl_vector.h:1187:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
 1187 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1187:35: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'const value_type&' {aka 'const int&'}
 1187 |       push_back(const value_type& __x)
      |                 ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_vector.h:1203:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]'
 1203 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/10/bits/stl_vector.h:1203:30: note:   no known conversion for argument 1 from 'std::string' {aka 'std::__cxx11::basic_string<char>'} to 'std::vector<int>::value_type&&' {aka 'int&&'}
 1203 |       push_back(value_type&& __x)
      |                 ~~~~~~~~~~~~~^~~
messy.cpp:86:13: error: 'mid' was not declared in this scope; did you mean 'mod'?
   86 |    dosth1(l,mid,vt1);
      |             ^~~
      |             mod
messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:93:5: error: 'compile_set' was not declared in this scope
   93 |     compile_set();
      |     ^~~~~~~~~~~
messy.cpp:98:35: error: 'p' was not declared in this scope
   98 |     for (int i=1;i<=n;i++) ans.pb(p[i]-1);
      |                                   ^