제출 #822185

#제출 시각아이디문제언어결과실행 시간메모리
822185alvingogo미술 수업 (IOI13_artclass)C++14
91 / 100
70 ms3304 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 long 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; } } //cout << dif << ' ' << gr << ' ' << dif2 << " " << gr2 << "\n"; if(dif<100000000){ return 4; } else if(dif>2000000000){ return 3; } if(gr2>5000000 || dif2<400000){ return 2; } return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...