제출 #191760

#제출 시각아이디문제언어결과실행 시간메모리
191760FieryPhoenixUnscrambling a Messy Bug (IOI16_messy)C++11
컴파일 에러
0 ms0 KiB
#include <iostream> #include <vector> #include <algorithm> #include <cmath> #include <cstdio> #include <map> #include <queue> #include <set> #include <iomanip> #include <deque> #include <cassert> #include <ctime> #include <cstring> #include <cstdlib> #include <chrono> #include <ctime> #include <random> #include <stack> #include <unordered_set> #include <unordered_map> #include <iterator> #include <climits> #include "messy.h" using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); typedef long long ll; typedef long double ld; #define INF 2001001001 #define MOD 1000000007 int ans[100001]; int N; bool contains(int x, vector<int>v){ for (int y:v) if (y==x) return true; return false; } void ask(int l, int r){ if (l>=r) return; for (int i=l;i<=(l+r)/2;i++){ string s=""; for (int j=0;j<N;j++) if (j<l || j>r) s+='1'; else if (j==i) s+='1'; else s+='0'; add_element(s); } ask(l,(l+r)/2); ask((l+r)/2+1,r); } void solve(int l, int r, vector<int>v){ string base=""; for (int i=0;i<N;i++) base+='1'; for (int x:v) base[x]='0'; vector<int>v2,v3; for (int i=l;i<=r;i++){ string s=base; s[v[i-l]]='1'; bool b=check_element(s); if (b) v2.push_back(v[i-l]); } for (int i=l;i<=r;i++) if (!contains(v[i-l],v2)) v3.push_back(v[i-l]); if (l+1==r){ ans[v2[0]]=l; ans[v3[0]]=r; return; } solve(l,(l+r)/2,v2); solve((l+r)/2+1,r,v3); } int[] restore_permutation(int n, int w, int r){ N=n; ask(0,n-1); compile_set(); vector<int>v; for (int i=0;i<n;i++) v.push_back(i); solve(0,n-1,v); return ans; }

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

messy.cpp:86:4: warning: decomposition declaration only available with -std=c++1z or -std=gnu++1z
 int[] restore_permutation(int n, int w, int r){
    ^
messy.cpp:86:4: error: decomposition declaration cannot be declared with type 'int'
 int[] restore_permutation(int n, int w, int r){
    ^~
messy.cpp:86:4: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
messy.cpp:86:4: error: empty decomposition declaration
messy.cpp:86:7: error: expected initializer before 'restore_permutation'
 int[] restore_permutation(int n, int w, int r){
       ^~~~~~~~~~~~~~~~~~~