Submission #15782

#TimeUsernameProblemLanguageResultExecution timeMemory
15782gs13068Art Class (IOI13_artclass)C++98
100 / 100
158 ms3580 KiB
#include "artclass.h" #include <cmath> int style(int H,int W,int R[500][500],int G[500][500],int B[500][500]) { double diff=0,border=0; int i,j; for(i=0;i<H;i++)for(j=0;j<W;j++) { if(i)diff+=pow(R[i][j]-R[i-1][j],2)+pow(G[i][j]-G[i-1][j],2)+pow(B[i][j]-B[i-1][j],2); if(j)diff+=pow(R[i][j]-R[i][j-1],2)+pow(G[i][j]-G[i][j-1],2)+pow(B[i][j]-B[i][j-1],2); } diff/=W*(H-1)+(W-1)*H; for(i=0;i<H;i++)for(j=0;j<W;j++) { if(i&&pow(R[i][j]-R[i-1][j],2)+pow(G[i][j]-G[i-1][j],2)+pow(B[i][j]-B[i-1][j],2)>diff)border+=1; if(j&&pow(R[i][j]-R[i][j-1],2)+pow(G[i][j]-G[i][j-1],2)+pow(B[i][j]-B[i][j-1],2)>diff)border+=1; } diff=sqrt(diff); border/=W*(H-1)+(W-1)*H; if(diff<13.5)return 4; if(border<0.18)return 1; if(diff>39)return 3; return 2; }
#Verdict Execution timeMemoryGrader output
Fetching results...