Submission #73754

#TimeUsernameProblemLanguageResultExecution timeMemory
73754aleksamScales (IOI15_scales)C++14
56.42 / 100
3 ms620 KiB
#include "scales.h" #include <bits/stdc++.h> using namespace std; int T; void init(int t) { t=T; } struct coin{ int id; }; int Max(int a, int b, int c){ return getHeaviest(a, b, c); } int Min(int a, int b, int c){ return getLightest(a, b, c); } int Mid(int a, int b, int c){ return getMedian(a, b, c); } int cl, cr; int l[3], r[3], u[6]; void stupid(){ while(cl<2 && cr<3){ u[cl+cr]=Min(l[cl], l[cl+1], r[cr]); if(u[cl+cr]==l[cl])cl++; else cr++; } while(cr<2 && cl<3){ u[cl+cr]=Min(l[cl], r[cr+1], r[cr]); if(u[cl+cr]==l[cl])cl++; else cr++; } //printf("cl=%d, cr=%d\n", cl, cr); if(cr==2 && cl==2){//+1 u[5]=Max(l[2], r[2], l[1]); u[4]=21-u[0]-u[1]-u[2]-u[3]-u[5]; answer(u); return; } if(cr==1 && cl==3){//0 u[5]=r[2]; u[4]=r[1]; answer(u); return; } if(cr==0 && cl==3){//0 u[5]=r[2]; u[4]=r[1]; u[3]=r[0]; answer(u); return; } if(cl==1 && cr==3){//0 u[5]=l[2]; u[4]=l[1]; answer(u); return; } if(cl==0 && cr==3){//0 u[5]=l[2]; u[4]=l[1]; u[3]=l[0]; answer(u); return; } answer(u); } void orderCoins() { /* int W[] = {1, 2, 3, 4, 5, 6}; answer(W);*/ cr=cl=0; l[0]=Min(1, 2, 3); l[2]=Max(1, 2, 3); l[1]=6-l[0]-l[2]; r[0]=Min(4, 5, 6); r[2]=Max(4, 5, 6); r[1]=4+5+6-r[0]-r[2]; //printf("l:%d %d %d r:%d %d %d\n", l[0], l[1], l[2], r[0], r[1], r[2]); int med=Mid(l[0], r[0], r[1]); if(med==l[0]){//max 7 u[0]=r[0]; u[1]=l[0]; cl=1; cr=1; med=Mid(l[1], r[1], r[2]);//No 6 if(med==l[1]){//+1 u[2]=r[1]; u[3]=l[1]; cl=cr=2; stupid(); return; } if(med==r[1]){//+1 u[2]=l[1]; cl=2; cr=1; med=Mid(l[2], r[1], r[2]); if(med==l[2]){ u[3]=r[1]; u[4]=l[2]; u[5]=r[2]; } if(med==r[1]){ u[3]=l[2]; u[4]=r[1]; u[5]=r[2]; } if(med==r[2]){ u[3]=r[1]; u[4]=r[2]; u[5]=l[2]; } answer(u); return; } if(med==r[2]){//0 u[2]=r[1]; u[3]=r[2]; u[4]=l[1]; u[5]=l[2]; answer(u); return; } return; } if(med==r[0]){ u[0]=l[0]; cl=1; cr=0; med=Mid(l[1], r[0], r[1]);//No 6 if(med==r[0]){//max 8 u[1]=l[1]; cl=2; cr=0; med=Mid(l[2], r[0], r[1]);//No7 if(med==r[0]){ u[2]=l[2]; u[3]=r[0]; u[4]=r[1]; u[5]=r[2]; answer(u); return; } if(med==r[1]){//+1 u[2]=r[0]; u[3]=r[1]; cl=2; cr=2; stupid(); return; } if(med==l[2]){//0 u[2]=r[0]; u[3]=l[2]; u[4]=r[1]; u[5]=r[2]; answer(u); return; } } if(med==r[1]){//+1 u[1]=r[0]; u[2]=r[1]; cr=2; cl=1; med=Mid(l[1], l[2], r[2]); if(med==l[1]){ u[3]=r[2]; u[4]=l[1]; u[5]=l[2]; answer(u); return; } if(med==l[2]){ u[3]=l[1]; u[4]=l[2]; u[5]=r[2]; answer(u); return; } if(med==r[2]){ u[3]=l[1]; u[4]=r[2]; u[5]=l[2]; answer(u); return; } return; } if(med==l[1]){//+1 u[1]=r[0]; u[2]=l[1]; cl=2; cr=1; med=Mid(r[1], l[2], r[2]); if(med==r[1]){ u[3]=l[2]; u[4]=r[1]; u[5]=r[2]; answer(u); return; } if(med==r[2]){ u[3]=r[1]; u[4]=r[2]; u[5]=l[2]; answer(u); return; } if(med==l[2]){ u[3]=r[1]; u[4]=l[2]; u[5]=r[2]; answer(u); return; } return; return; } return; } if(med==r[1]){//+2 u[0]=r[0]; u[1]=r[1]; cr=2; cl=0; med=getNextLightest(l[0], l[1], l[2], r[2]); if(med==l[2]){//0 u[2]=l[0]; u[3]=l[1]; u[4]=r[2]; u[5]=l[2]; answer(u); return; } if(med==l[1]){//0 u[2]=l[0]; u[3]=r[2]; u[4]=l[1]; u[5]=l[2]; answer(u); return; } if(med==l[0]){//1 med=Max(l[0], l[2], r[2]); if(med==r[2]){//0 u[2]=l[0]; u[3]=l[1]; u[4]=l[2]; u[5]=r[2]; answer(u); return; } if(med==l[2]){//0 u[2]=r[2]; u[3]=l[0]; u[4]=l[1]; u[5]=l[2]; answer(u); return; } } return; } }

Compilation message (stderr)

In file included from grader.c:2:0:
graderlib.c: In function 'void answer(int*)':
graderlib.c:53:5: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
     if (_ghksjhdfkae19ga_ > 1) 
     ^~
graderlib.c:56:2: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
  for (i = 0; i < 6; i++) {
  ^~~
scales.cpp: In function 'void init(int)':
scales.cpp:9:15: warning: parameter 't' set but not used [-Wunused-but-set-parameter]
 void init(int t) {
               ^
#Verdict Execution timeMemoryGrader output
Fetching results...