Submission #64086

#TimeUsernameProblemLanguageResultExecution timeMemory
64086gs13068Scales (IOI15_scales)C++17
0 / 100
5 ms976 KiB
#include "scales.h" #include <cstdio> #include <algorithm> void init(int T){} int p[777]; int t[7]; int testMed(int a,int b,int c) { int i,j,k,r=0; for(i=0;i<720;i++)if(p[i]) { for(j=1;j<=6;j++)t[j]=j; k=i; for(j=1;j<=6;j++) { std::swap(t[j],t[k%j+1]); k/=j; } if((t[a]<t[b]&&t[b]<t[c])||(t[a]>t[b]&&t[b]>t[c]))r++; } return r; } void orderCoins() { int i,j,k,a,b,c,r=0; a=getLightest(1,2,3); b=getNextLightest(4,5,6,a); for(i=0;i<720;i++) { for(j=1;j<=6;j++)t[j]=j; k=i; for(j=1;j<=6;j++) { std::swap(t[j],t[k%j+1]); k/=j; } p[i]=0; k=0; for(j=1;j<=3;j++)if(!k||t[j]<t[k])k=j; if(k!=a)continue; k=0; for(j=4;j<=6;j++)if(t[j]>t[a]&&(!k||t[j]<t[k]))k=j; if(!k)for(j=4;j<=6;j++)if(!k||t[j]<t[k])k=j; if(k!=b)continue; p[i]=1; r++; } for(;r>1;) { for(i=1;i<=6;i++) { for(j=1;j<i;j++) { for(k=1;k<j;k++)if(testMed(i,j,k)<=(r+2)/3&&testMed(j,k,i)<=(r+2)/3&&testMed(k,i,j)<=(r+2)/3)break; if(k<j)break; } if(j<i)break; } if(r==80)i=2,j=5,k=6; b=getMedian(i,j,k); if(b==i)a=j,c=k; if(b==j)a=i,c=k; if(b==k)a=i,c=j; r=0; for(i=0;i<720;i++)if(p[i]) { for(j=1;j<=6;j++)t[j]=j; k=i; for(j=1;j<=6;j++) { std::swap(t[j],t[k%j+1]); k/=j; } p[i]=0; if((t[a]<t[b]&&t[b]<t[c])||(t[a]>t[b]&&t[b]>t[c])) { p[i]=1; r++; } } } }

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:5:19: warning: unused parameter 'T' [-Wunused-parameter]
     void init(int T){}
                   ^
scales.cpp: In function 'void orderCoins()':
scales.cpp:88:55: warning: 'c' may be used uninitialized in this function [-Wmaybe-uninitialized]
        if((t[a]<t[b]&&t[b]<t[c])||(t[a]>t[b]&&t[b]>t[c]))
                                                    ~~~^
#Verdict Execution timeMemoryGrader output
Fetching results...