제출 #755631

#제출 시각아이디문제언어결과실행 시간메모리
755631Theo830저울 (IOI15_scales)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; typedef int ll; const ll INF = 1e9+7; const ll MOD = 998244353; typedef pair<ll,ll> ii; #define iii pair<ll,ii> #define f(i,a,b) for(ll i = a;i < b;i++) #define pb push_back #define vll vector<ll> #define F first #define S second #define all(x) (x).begin(), (x).end() #include "scales.h" void init(int T) { } void orderCoins() { vector<int>P; f(i,0,6){ P.pb(i+1); } set<vector<int> >ex; do{ ex.insert(P); } while(next_permutation(all(P))); while(ex.size() > 1){ ll t = 0,a,b,c,d,ans = 0; f(i,0,6){ f(j,i+1,6){ f(k,j+1,6){ ll res = INF; ll cur = 0; for(auto x:ex){ if(x[i] < x[j] && x[i] < x[k]){ } else{ cur++; } } res = min(res,cur); cur = 0; for(auto x:ex){ if(x[j] < x[i] && x[j] < x[k]){ } else{ cur++; } } res = min(res,cur); cur = 0; for(auto x:ex){ if(x[k] < x[i] && x[k] < x[j]){ } else{ cur++; } } res = min(res,cur); if(ans < res){ ans = res; t = 0; a = i; b = j; c = k; } } } } f(i,0,6){ f(j,i+1,6){ f(k,j+1,6){ ll res = INF; ll cur = 0; for(auto x:ex){ if(x[i] > x[j] && x[i] > x[k]){ } else{ cur++; } } res = min(res,cur); cur = 0; for(auto x:ex){ if(x[j] > x[i] && x[j] > x[k]){ } else{ cur++; } } res = min(res,cur); cur = 0; for(auto x:ex){ if(x[k] > x[i] && x[k] > x[j]){ } else{ cur++; } } res = min(res,cur); if(ans < res){ ans = res; t = 2; a = i; b = j; c = k; } } } } f(i,0,6){ f(j,i+1,6){ f(k,j+1,6){ f(u,0,6){ if(u != i && u != j && u != k){ ll res = INF; ll cur = 0; for(auto x:ex){ vector<ii>ar; ar.pb(ii(x[i],i)); ar.pb(ii(x[j],j)); ar.pb(ii(x[u],u)); ar.pb(ii(x[k],k)); bool ok; if(ar.back().S == u){ ok = ar[0].S == i; } else{ f(r,0,3){ if(ar[r].S == u){ ok = ar[r+1].S == i; break; } } } if(!ok){ cur++; } } res = min(res,cur); cur = 0; for(auto x:ex){ vector<ii>ar; ar.pb(ii(x[i],i)); ar.pb(ii(x[j],j)); ar.pb(ii(x[u],u)); ar.pb(ii(x[k],k)); bool ok; if(ar.back().S == u){ ok = ar[0].S == j; } else{ f(r,0,3){ if(ar[r].S == u){ ok = ar[r+1].S == j; break; } } } if(!ok){ cur++; } } res = min(res,cur); cur = 0; for(auto x:ex){ vector<ii>ar; ar.pb(ii(x[i],i)); ar.pb(ii(x[j],j)); ar.pb(ii(x[u],u)); ar.pb(ii(x[k],k)); bool ok; if(ar.back().S == u){ ok = ar[0].S == k; } else{ f(r,0,3){ if(ar[r].S == u){ ok = ar[r+1].S == k; break; } } } if(!ok){ cur++; } } res = min(res,cur); if(ans < res){ ans = res; t = 3; a = i; b = j; c = k; d = u; } } } } } } a++; b++; c++; set<vector<int> >fkale; if(t == 0){ ll pos = getLightest(a,b,c); a--; b--; c--; pos--; for(auto x:ex){ if(x[pos] <= x[a] && x[pos] <= x[b] && x[pos] <= x[c]){ } else{ fkale.insert(x); } } } else if(t == 1){ ll pos = getMedian(a,b,c); a--; b--; c--; pos--; for(auto x:ex){ ll posoi = (x[pos] > x[a]) + (x[pos] > x[b]) + (x[pos] > x[c]); if(posoi != 1){ fkale.insert(x); } } } else if(t == 2){ ll pos = getHeaviest(a,b,c); a--; b--; c--; pos--; for(auto x:ex){ if(x[pos] >= x[a] && x[pos] >= x[b] && x[pos] >= x[c]){ } else{ fkale.insert(x); } } } else{ } for(auto x:fkale){ ex.erase(x); } } vll a = (*ex.begin()); f(i,0,6){ W[a[i]-1] = i+1; } answer(W); }

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

scales.cpp: In function 'void init(int)':
scales.cpp:15:15: warning: unused parameter 'T' [-Wunused-parameter]
   15 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:29:24: warning: variable 'd' set but not used [-Wunused-but-set-variable]
   29 |         ll t = 0,a,b,c,d,ans = 0;
      |                        ^
scales.cpp:265:9: error: 'W' was not declared in this scope
  265 |         W[a[i]-1] = i+1;
      |         ^
scales.cpp:267:12: error: 'W' was not declared in this scope
  267 |     answer(W);
      |            ^