Submission #138846

#TimeUsernameProblemLanguageResultExecution timeMemory
138846dnassScales (IOI15_scales)C++14
0 / 100
5 ms376 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; int xxxxxxxxxxx; void init(int T){ xxxxxxxxxxx = T; } void orderCoins(){ ++xxxxxxxxxxx; int f3 = getHeaviest(1,2,3); int f1 = getLightest(1,2,3); int f2 = -1; for(int i=1;i<=3;i++){ if(i!=f3&&i!=f1) f2 = i; } int f[] = {f1, f2, f3}; int s3 = getHeaviest(4,5,6); int s1 = getLightest(4,5,6); int s2 = -1; for(int i=4;i<=6;i++){ if(i!=s3&&i!=s1) s2 = i; } int s[] = {s1, s2, s3}; int W[6]; int x = 2, y = 2; if(getHeaviest(f[x], s[y], f[x-1])==f[x]){ W[5] = f[x]; x--; }else{ W[5] = s[y]; y--; } while(x>=0&&y>=0){ //cout << x << " " << y << endl; //cout << W[x+y+2] << " " << f[x] << " " << s[y] << endl; if(getMedian(W[x+y+2], f[x], s[y])==f[x]){ W[x+y+1] = f[x]; --x; }else{ W[x+y+1] = s[y]; --y; } } if(x==0) W[0] = f[0]; else W[0] = s[0]; answer(W); /* int x1 = getNextLightest(s1, s2, s3, f1); if(x1==s1){ if(getHeaviest(s1,f1,s3)==f1){ int W[6] = {s1, s2, s3, f1, f2, f3}; answer(W); }else{ } }else if(x1==s2){ int x2 = getNextLightest(s2, s3, f3, f2); if(x2==f3){ int x3 = getMedian(f2, s2, s3); if(x3==f2){ int W[6] = {s1, f1, s2, f2, s3, f3}; answer(W); }else if(x3==s2){ int W[6] = {s1, f1, f2, f3, s2, f3}; answer(W); }else{ int W[6] = {s1, f1, s2, s3, f2, f3}; answer(W); } }else if(x2==s3){ int W[6] = {s1, f1, s2, f2, s3, f3}; answer(W); }else{ if(getHeaviest(s1, s3, f3)==s3){ int W[6] = {s1, f1, f2, s2, f3, s3}; answer(W); }else{ int W[6] = {s1, f1, f2, s2, s3, f3}; answer(W); } } }else{ int x2 = getMedian(f2, f3, s3); if(x2==s3){ int W[6] = {s1, s2, f1, f2, s3, f3}; answer(W); }else if(x2==f2){ int W[6] = {s1, s2, f1, s3, f2, f3}; answer(W); }else{ int W[6] = {s1, s2, f1, f2, f3, s3}; answer(W); } } */ }
#Verdict Execution timeMemoryGrader output
Fetching results...