제출 #650361

#제출 시각아이디문제언어결과실행 시간메모리
650361rafatoaUnscrambling a Messy Bug (IOI16_messy)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef long long int ll; typedef long double ld; #pragma GCC optimize ("Ofast") #define int ll #define double ld const int inf = 2e9; const int INF = 4e18; const int mod = 1e9+7; #define F first #define S second #define vi vector<int> #define vvi vector<vi> #define pi pair<int, int> #define vpi vector<pi> #define vb vector<bool> #define vvb vector<vb> #define pb push_back #define read(a) for(auto &x:a) cin >> x; #define print(a) for(auto x:a) cout << x << " "; cout << "\n"; #define rs resize #define as assign #define vc vector<char> #define vvc vector<vc> #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define ppb pop_back #define MP make_pair void add_element(string x); void compile_set(); bool check_element(string x); int[] restore_permutation(int n, int w, int r){ int p[n]; function<void(int, int)> add = [&](int l, int r){ if(l == r) return; for(int j=l; j<l+(r-l+1)/2; j++){ string s; for(int i=0; i<n; i++) if(i < l || i > r || i == j) s += '1'; else s += '0'; add_element(s); } add(l, l+(r-l+1)/2-1); add(l+(r-l+1)/2, r); }; add(0, n-1); compile_set(); function<void(int, int, vi)> solve = [&](int l, int r, vi v){ if(l == r){ p[n-1-l] = n-1-v[0]; return; } vi a, b; for(auto &x:v){ string s; for(int i=0; i<n; i++){ if(i != x && binary_search(all(v), i)) s += '0'; else s += '1'; } if(check_element(s)) a.pb(x); else b.pb(x); } solve(l, l+(r-l+1)/2-1, a); solve(l+(r-l+1)/2, r, b); }; vi v; iota(all(v), 0); solve(0, n-1, v); return p; } /*stolen stuff you should look for * int overflow, array bounds * special cases (n=1?) * READ CONSTRAINTS * do smth instead of nothing and stay organized * WRITE STUFF DOWN * DON'T GET STUCK ON ONE APPROACH */

컴파일 시 표준 에러 (stderr) 메시지

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