제출 #358351

#제출 시각아이디문제언어결과실행 시간메모리
358351talant117408저울 (IOI15_scales)C++17
55.56 / 100
1 ms384 KiB
#include "scales.h" #ifndef EVAL #include "grader.cpp" #endif #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair <int, int> pii; typedef pair <ll, ll> pll; #define precision(n) fixed << setprecision(n) #define pb push_back #define ub upper_bound #define lb lower_bound #define mp make_pair #define eps (double)1e-9 #define PI 2*acos(0.0) #define endl "\n" #define sz(v) int((v).size()) #define all(v) v.begin(),v.end() #define rall(v) v.rbegin(),v.rend() #define do_not_disturb ios::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define OK cout << "OK" << endl; void init(int T){ } void orderCoins(){ int mx1 = getHeaviest(1, 2, 3), mx2 = getHeaviest(4, 5, 6), mn1 = getLightest(1, 2, 3), mn2 = getLightest(4, 5, 6), md1, md2; md1 = 6-mx1-mn1; md2 = 15-mx2-mn2; int w[7]; memset(w, -1, sizeof(w)); /*if(getHeaviest(md1, mx1, mx2) == mx2){ w[mx2] = 6; if(getHeaviest(md1, mx1, md2) == md2){ w[md2] = 5; if(getHeaviest(md1, mx1, mn2) == mn2){ w[mn2] = 4; w[mx1] = 3; w[md1] = 2; w[mn1] = 1; answer(w); } else{ w[mx1] = 4; auto tmp = getMedian( } } }*/ auto ans1 = getMedian(md1, mx1, mx2); if(ans1 == md1){ w[mx1] = 6; w[md1] = 5; auto ans2 = getMedian(mn1, md2, mx2); if(ans2 == mx2){ w[mn1] = 4; w[mx2] = 3; w[md2] = 2; w[mn2] = 1; } else if(ans2 == md2){ w[mx2] = 4; w[md2] = 3; auto ans3 = getLightest(mn1, mn2, mx1); if(ans3 == mn1){ w[mn2] = 2; w[mn1] = 1; } else{ w[mn1] = 2; w[mn2] = 1; } } else{ w[mx2] = 4; w[mn1] = 3; w[md2] = 2; w[mn2] = 1; } } else if(ans1 == mx2){ w[mx1] = 6; w[mx2] = 5; auto ans2 = getMedian(mn1, md1, md2); if(ans2 == mn1){ w[md1] = 4; w[mn1] = 3; w[md2] = 2; w[mn2] = 1; } else if(ans2 == md1){ w[md2] = 4; auto ans3 = getMedian(mn1, mn2, md1); if(ans3 == mn1){ w[md1] = 3; w[mn1] = 2; w[mn2] = 1; } else if(ans3 == md1){ w[mn2] = 3; w[md1] = 2; w[mn1] = 1; } else{ w[md1] = 3; w[mn2] = 2; w[mn1] = 1; } } else{ w[md1] = 4; w[md2] = 3; auto ans3 = getLightest(mn1, mn2, mx1); if(ans3 == mn1){ w[mn2] = 2; w[mn1] = 1; } else{ w[mn1] = 2; w[mn2] = 1; } } } else if(ans1 == mx1){ w[mx2] = 6; auto ans2 = getMedian(mx1, mn2, md1); if(ans2 == mx1){ w[md2] = 5; w[mn2] = 4; w[mx1] = 3; w[md1] = 2; w[mn1] = 1; } else if(ans2 == mn2){ w[md1] = 2; w[mn1] = 1; w[mn2] = 3; auto ans3 = getHeaviest(mx1, md2, mn1); if(ans3 == mx1){ w[mx1] = 5; w[md2] = 4; } else{ w[mx1] = 4; w[md2] = 5; } } else{ auto ans3 = getMedian(mn1, mn2, md2); if(ans3 == md2){ w[mx1] = 5; w[md1] = 4; w[mn1] = 3; w[md2] = 2; w[mn2] = 1; } else if(ans3 == mn1){ w[mn2] = 1; w[mn1] = 2; auto ans4 = getMedian(md1, mx1, md2); if(ans4 == md1){ w[mx1] = 5; w[md1] = 4; w[md2] = 3; } else if(ans4 == mx1){ w[md2] = 5; w[mx1] = 4; w[md1] = 3; } else{ w[mx1] = 5; w[md2] = 4; w[md1] = 3; } } else{ w[mn1] = 1; w[mn2] = 2; auto ans4 = getMedian(md1, mx1, md2); if(ans4 == md1){ w[mx1] = 5; w[md1] = 4; w[md2] = 3; } else if(ans4 == mx1){ w[md2] = 5; w[mx1] = 4; w[md1] = 3; } else{ w[mx1] = 5; w[md2] = 4; w[md1] = 3; } } } } for(int i = 1; i < 7; i++){ w[i-1] = w[i]; w[i-1]--; } int ans[6]; for(int i = 0; i < 6; i++){ ans[w[i]] = i+1; } answer(ans); }

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

scales.cpp: In function 'void init(int)':
scales.cpp:27:15: warning: unused parameter 'T' [-Wunused-parameter]
   27 | void init(int T){
      |           ~~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...