제출 #254930

#제출 시각아이디문제언어결과실행 시간메모리
254930ChrisTUnscrambling a Messy Bug (IOI16_messy)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; int ret[200],n; void build (int l, int r) { if (l == r) return; string go = string(n,'0'); for (int i = l; i <= r; i++) go[i] = '1'; int mid = (l + r) / 2; for (int i = l; i <= mid; i++) { go[i] = '0'; add_element(go); go[i] = '1'; } build(l,mid); build(mid+1,r); } void solve (int l, int r, vector<int> &wot) { if (l == r) return (void) (ret[l] = wot[0]); vector<int> wotL, wotR; string go = string(n,'0'); for (int i : wot) go[i] = '1'; for (int i : wot) { go[i] = '0'; if (check_element(go)) wotL.push_back(i); else wotR.push_back(i); go[i] = '1'; } int mid = (l + r) / 2; solve(l,mid,wotL); solve(mid+1,r,wotR); } int *restore_permutation (int N, int w, int r) { n=N; vector<int> go(n); iota(go.begin(),go.end(),0); build(0,n-1); compile_set(); solve(0,n-1,go); return ret; }

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

messy.cpp: In function 'int* restore_permutation(int, int, int)':
messy.cpp:31:6: error: ambiguating new declaration of 'int* restore_permutation(int, int, int)'
 int *restore_permutation (int N, int w, int r) {
      ^~~~~~~~~~~~~~~~~~~
In file included from messy.cpp:2:0:
messy.h:10:18: note: old declaration 'std::vector<int> restore_permutation(int, int, int)'
 std::vector<int> restore_permutation(int n, int w, int r);
                  ^~~~~~~~~~~~~~~~~~~