Submission #822233

#TimeUsernameProblemLanguageResultExecution timeMemory
822233alvingogoArt Class (IOI13_artclass)C++14
98 / 100
63 ms3812 KiB
#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.4){ return 2; } return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...