제출 #536908

#제출 시각아이디문제언어결과실행 시간메모리
536908DJ035Unscrambling a Messy Bug (IOI16_messy)C++17
컴파일 에러
0 ms0 KiB
#include "messy.h" #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #pragma GCC optimize("unroll-loops") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2") #include <bits/stdc++.h> #define MEM 222 #define sanic ios_base::sync_with_stdio(0) #define x first #define y second #define pf push_front #define pb push_back #define all(v) v.begin(), v.end() #define sz size() using namespace std; typedef long long ll; typedef pair<ll, ll> pi; const ll INF = 1e17+7; const ll MOD = 998244353; ll gcd(ll a, ll b){ if(a%b) return gcd(b, a%b); return b; } int N; vector<ll> ans; void ins(int l, int r) { if(r-l==1) return; string s(N, '0'); int mid=l+r>>1; for(int i=l; i<r; i++) s[i] = '1'; for(int i=l; i<mid; i++) { s[i] = '0'; add_element(s); s[i] = '1'; } ins(l, mid); ins(mid, r); } void hwak(vector<int> a, int k) { if(a.sz()==1) { ans[a[0]] = k; return; } vector<int> l, r; string s(N,'0'); for(int i:a) s[i] = '1'; for(int i:a) { s[i] = '0'; if(check_element(s)) l.push_back(i); else r.push_back(i); s[i] = '1'; } hwak(l, k); hwak(r, k+r.size()); } std::vector<int> restore_permutation(int n, int w, int r) { vector<int> im; ans.resize(n); N = n; ins(0, n); compile_set(); for(int i=0; i<n; i++) im.push_back(i); hwak(im, 0); return ans; }

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

messy.cpp: In function 'void ins(int, int)':
messy.cpp:29:14: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   29 |     int mid=l+r>>1;
      |             ~^~
messy.cpp: In function 'void hwak(std::vector<int>, int)':
messy.cpp:42:13: error: expression cannot be used as a function
   42 |     if(a.sz()==1) {
      |             ^
messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:69:12: error: could not convert 'ans' from 'vector<long long int>' to 'vector<int>'
   69 |     return ans;
      |            ^~~
      |            |
      |            vector<long long int>