# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
15782 | gs13068 | Art Class (IOI13_artclass) | C++98 | 158 ms | 3580 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |