제출 #755620

#제출 시각아이디문제언어결과실행 시간메모리
755620Theo830저울 (IOI15_scales)C++17
0 / 100
8 ms596 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() ///I hope I will get uprating and don't make mistakes ///I will never stop programming ///sqrt(-1) Love C++ ///Please don't hack me ///@TheofanisOrfanou Theo830 ///Think different approaches (bs,dp,greedy,graphs,shortest paths,mst) ///Stay Calm ///Look for special cases ///Beware of overflow and array bounds ///Think the problem backwards ///Training #include "scales.h" void init(int T) { } void orderCoins() { int W[] = {1, 2, 3, 4, 5, 6}; 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 if(x[i] > x[j] && x[i] < x[k]){ } else{ cur++; } } res = min(res,cur); cur = 0; for(auto x:ex){ if(x[k] < x[j] && x[k] > x[i]){ } else if(x[k] > x[j] && x[k] < x[i]){ } else{ cur++; } } res = min(res,cur); cur = 0; for(auto x:ex){ if(x[j] < x[i] && x[j] > x[k]){ } else if(x[j] > x[i] && x[j] < x[k]){ } else{ cur++; } } res = min(res,cur); if(ans < res){ ans = res; t = 1; 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; } } } } set<vector<int> >fkale; if(t == 0){ ll pos = getLightest(a,b,c); 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); 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); 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[i] = a[i]; } answer(W); }

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

scales.cpp: In function 'void init(int)':
scales.cpp:26:15: warning: unused parameter 'T' [-Wunused-parameter]
   26 | void init(int T) {
      |           ~~~~^
scales.cpp: In function 'void orderCoins()':
scales.cpp:41:24: warning: unused variable 'd' [-Wunused-variable]
   41 |         ll t = 0,a,b,c,d,ans = 0;
      |                        ^
#Verdict Execution timeMemoryGrader output
Fetching results...