Submission #301473

#TimeUsernameProblemLanguageResultExecution timeMemory
301473matheo_apdUnscrambling a Messy Bug (IOI16_messy)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; #define all(x) begin(x), end(x) #define pb push_back #define maxn 130 int n_; int ans[maxn]; void add(int l, int r){ if(l == r) return; string c; for(int i = 0; i < n_; i++){ if(l <= i and i <= r) c.pb('1'); else c.pb('0'); } int mid = (l+r)/2; for(int i = l; i <= mid; i++){ c[i] = '0'; add_element(c); c[i] = 1; } add(l, mid); add(mid+1, r); } void solve(int l, int r, vector<int> caras){ if(l == r){ ans[caras[0]] = l; return; } vector<int> L, R; string c; for(int i = 0; i < n_; i++){ if(binary_search(all(caras), i)) c.pb('1'); else c.pb('0'); } for(auto i : caras){ c[i] = '0'; if(check_element(c)) L.push_back(i); else R.push_back(i); c[i] = '1'; } int mid = (l+r)/2; solve(l, mid, L); solve(mid+1, r, R); } int[] restore_permutation(int n, int w, int r){ n_ = n; add(0, n-1); compile_set(); vector<int> caras; for(int i = 0; i < n; i++) caras.push_back(i); solve(0, n-1, caras); int resp[n]; for(int i = 0; i < n; i++) resp[i] = ans[i]; return resp; }

Compilation message (stderr)

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