# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
8134 | gs13073 | Art Class (IOI13_artclass) | C++98 | 0 ms | 0 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<stdio.h>
#include<math.h>
double val[505][505];
double a,v,sq;
int style(int H,int W,int R[500][500],int G[500][500],int B[500][500])
{
int i,j,k,l;
int A[8][2]={{1,1},{1,0},{1,-1},{-1,1},{-1,0},{-1,-1},{0,1},{0,-1}};
//FILE *out=fopen("1.out","w");
for(i=0;i<H;i++){
for(j=0;j<W;j++){
int cnt=0;
double sum=0,tmp=0;
int r=R[i][j];
int g=G[i][j];
int b=B[i][j];
for(k=0;k<8;k++){
i+=A[k][0];
j+=A[k][1];
if(i>=0 && i<H && j>=0 && j<W){
tmp=(R[i][j]-r)*(R[i][j]-r)
+(G[i][j]-g)*(G[i][j]-g)
+(B[i][j]-b)*(B[i][j]-b);
tmp=sqrt(tmp);
sum+=tmp;
cnt++;
}
i-=A[k][0];
j-=A[k][1];
}
val[i][j]=sum/cnt;
a+=val[i][j];
sq+=(val[i][j]*val[i][j]);
}
}
a/=(H*W);
sq/=(H*W);
double b=sq-a*a;
//printf("%lf %lf",a,b);
if(a*b < 500 )return 4;
else if(b>500 && a>30)return 3;
else if(b/a > 15)return 1;
else return 2;
return 0;
}