Submission #586182

#TimeUsernameProblemLanguageResultExecution timeMemory
586182Do_you_copyUnscrambling a Messy Bug (IOI16_messy)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include <messy.h> #define taskname "test" #define fi first #define se second #define pb push_back #define faster ios_base::sync_with_stdio(0); cin.tie(0); using namespace std; using ll = long long; using pii = pair <int, int>; ll min(const ll &a, const ll &b){ return (a < b) ? a : b; } ll max(const ll &a, const ll &b){ return (a > b) ? a : b; } const ll Mod = 1000000007; const int maxN = 1e5 + 1; int n; int a[128]; int hiddenarray[] = {3, 1, 7, 4, 5, 0, 6, 2}; vector <string> v; struct TNode{ vector <int> q; }; /* void add_element(string s){ v.pb(s); } void compile_set(){ for (string &t: v){ string tt = t; for (int i = 0; i < n; ++i){ tt[i] = t[hiddenarray[i]]; } t = tt; } } bool check_element(string s){ for (string t: v){ if (s == t) return 1; } return 0; }*/ void dnc(int l, int r){ if (l == r) return; int m = (l + r) / 2; string s = ""; for (int i = 1; i < l; ++i) s += '1'; for (int i = l; i <= r; ++i) s += '0'; for (int i = r + 1; i <= n; ++i) s += '1'; for (int i = l; i <= m; ++i){ s[i - 1] = '1'; add_element(s); s[i - 1] = '0'; } dnc(l, m); dnc(m + 1, r); } void dncreturnans(int l, int r, string s){ vector <int> left, right; for (int i = 0; i < n; ++i){ if (s[i] == '0'){ s[i] = '1'; if (check_element(s)){ left.pb(i); } else right.pb(i); s[i] = '0'; } } if (r - l == 1){ a[left[0]] = l - 1; a[right[0]] = r - 1; return; } int m = (l + r) / 2; for (int i: right) s[i] = '1'; dncreturnans(l, m, s); for (int i: right) s[i] = '0'; for (int i: left) s[i] = '1'; dncreturnans(m + 1, r, s); } int[] restore_permutation(int N, int w, int r, int* result){ n = N; int b[n]; dnc(1, n); compile_set(); string s; for (int i = 1; i <= n; ++i) s += '0'; dncreturnans(1, n, s); for (int i = 0; i < n; ++i) b[i] = a[i]; return b; }

Compilation message (stderr)

messy.cpp:94:4: error: structured binding declaration cannot have type 'int'
   94 | int[] restore_permutation(int N, int w, int r, int* result){
      |    ^~
messy.cpp:94:4: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
messy.cpp:94:4: error: empty structured binding declaration
messy.cpp:94:7: error: expected initializer before 'restore_permutation'
   94 | int[] restore_permutation(int N, int w, int r, int* result){
      |       ^~~~~~~~~~~~~~~~~~~