# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
7418 | kriii | Art Class (IOI13_artclass) | C++98 | 176 ms | 3632 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<cstdio>
#include<cstdlib>
#include<math.h>
int rr[4]={1,0,-1,0};
int cc[4]={0,1,0,-1};
int chk[5]={0,16000000,21875470,50990276,3100000};
int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
int ar=0,ag=0,ab=0;
int i,j,k,diff=0;
int mn,mnn;
for(i=0;i<H;i++){
for(j=0;j<W;j++){
for(k=0;k<4;k++){
if((i+rr[k]+1)*(i+rr[k]-H)<0&&(j+cc[k]+1)*(j+cc[k]-W)<0){
ar+=abs(R[i][j]-R[i+rr[k]][j+cc[k]]);
ag+=abs(G[i][j]-G[i+rr[k]][j+cc[k]]);
ab+=abs(B[i][j]-B[i+rr[k]][j+cc[k]]);
}
}
}
}
diff=ar+ag+ab;
mn=abs(diff-chk[1]);
mnn=1;
for(i=2;i<=4;i++){
if(mn>abs(diff-chk[i])){
mnn=i;
mn=abs(diff-chk[i]);
}
}
return mnn;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |