# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
822254 | alvingogo | Art Class (IOI13_artclass) | C++14 | 62 ms | 3856 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 <bits/stdc++.h>
using namespace std;
int style(int h, int w, int R[500][500], int G[500][500], int B[500][500]) {
long double dif=0,gr=0,dif2=0,gr2=0;
const int dx[4]={1,1,1,0},dy[4]={1,0,-1,1};
for(int i=0;i<h;i++){
for(int j=0;j<w;j++){
for(int k=0;k<4;k++){
int a=i+dx[k],b=j+dy[k];
if(a>=h || b>=w || a<0 || b<0){
continue;
}
int dz=(R[i][j]-R[a][b])*(R[i][j]-R[a][b])+(G[i][j]-G[a][b])*(G[i][j]-G[a][b])+(B[i][j]-B[a][b])*(B[i][j]-B[a][b]);
dif+=dz;
dif2+=(dz<=100);
}
int z=max(0,G[i][j]-max(R[i][j],B[i][j]));
gr+=1ll*z*z*z;
gr2+=1ll*z*z;
}
}
gr/=(h*w);
gr2/=(h*w);
dif/=(h*w);
dif2/=(h*w);
//cout << dif << ' ' << gr << ' ' << dif2 << " " << gr2 << "\n";
if(dif<1000){
return 4;
}
else if(dif>8000){
return 3;
}
if(dif2<2.1){
return 2;
}
return 1;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |