Submission #398352

#TimeUsernameProblemLanguageResultExecution timeMemory
398352kevinxiehkUnscrambling a Messy Bug (IOI16_messy)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; // TODO: global variables can be declared here int ans[128]; int idk[128]; char s[128]; int N; void add(int l,int x){ if(x==1)return; for(int i=0;i<N;i++)s[i]='1'; for(int i=l;i<l+x;i++)s[i]='0'; for(int i=l;i<l+x/2;i++){ s[i]='1'; add_element(s); //cout<<s<<'\n'; s[i]='0'; } add(l,x/2); add(l+x/2,x/2); } void check(int l,int x,int a){ //cout<<l<<' '<<x<<' '<<a<<'\n'; //for(int i=0;i<N;i++)cout<<idk[i]<<' ';cout<<'\n'; if(x==1){ //cout<<l<<' '<<a<<'\n'; for(int i=0;i<N;i++)if(idk[i]==a)ans[l]=i; return; } for(int i=0;i<N;i++)s[i]='1'; for(int i=0;i<N;i++)if(idk[i]==a)s[i]='0'; for(int i=0;i<N;i++){ if(idk[i]!=a)continue; s[i]='1'; if(check_element(s))idk[i]=a*2; else idk[i]=a*2+1; s[i]='0'; } check(l,x/2,a*2); check(l+x/2,x/2,a*2+1); } vector<int> restore_permutation(int n, int w, int r) { // TODO: implementation // example solution that checks if p_1 = 2 // Subtask 1 case 6 and 9 accepted N=n; add(0,n); compile_set(); //for(auto x:ele)cout<<x<<'\n'; for(int i=0;i<n;i++)idk[i]=1; check(0,n,1); return ans; }

Compilation message (stderr)

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:53:12: error: could not convert 'ans' from 'int [128]' to 'std::vector<int>'
   53 |     return ans;
      |            ^~~
      |            |
      |            int [128]