제출 #7418

#제출 시각아이디문제언어결과실행 시간메모리
7418kriii미술 수업 (IOI13_artclass)C++98
73 / 100
176 ms3632 KiB
#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 timeMemoryGrader output
Fetching results...