Submission #8505

#TimeUsernameProblemLanguageResultExecution timeMemory
8505gs13023Art Class (IOI13_artclass)C++98
0 / 100
140 ms9468 KiB
#include "artclass.h" int abs(int a){return a>0?a:-a;} int max(int a,int b){return a>b?a:b;} int style(int H,int W,int R[500][500],int G[500][500],int B[500][500]) { //1 몬드리안 //2 숲 //3 뿌리는거 //4 창호지 int dif1[3][500][500]; int dif2[3][500][500]; int M=0; for(int i=0;i<H;i++) { for(int j=0;j<W-1;j++) { dif1[0][i][j]=R[i][j+1]-R[i][j]; dif1[1][i][j]=G[i][j+1]-G[i][j]; dif1[2][i][j]=B[i][j+1]-B[i][j]; M=max(M,G[i][j]); } } for(int i=0;i<H-1;i++) { for(int j=0;j<W;j++) { dif2[0][i][j]=R[i+1][j]-R[i][j]; dif2[1][i][j]=G[i+1][j]-G[i][j]; dif2[2][i][j]=B[i+1][j]-B[i][j]; } } /* int bc=0; for(int i=0;i<H;i++) { int black=0; for(int j=0;j<W;j++) { black+=(R[i][j]>220&&G[i][j]>220&&B[i][j]>220); } if(black==W)bc++; } if(bc>(H/50)+1)return 4; int bc2=0; for(int i=0;i<W;i++) { int black2=0; for(int j=0;j<H;j++) { black2+=(R[i][j]>220&&G[i][j]>220&&B[i][j]>220); } if(black2==H)bc2++; } if(bc2>(W/50)+1)return 4; */ int GG=0; for(int i=0;i<H;i++) { for(int j=0;j<W;j++) { GG+=G[i][j]; } } int cnt=0,cnt2=0; for(int i=0;i<H;i++) { for(int j=0;j<W;j++) { for(int k=0;k<3;k++) { cnt+=(dif1[k][i][j]>20); cnt2+=(dif2[k][i][j]>20); } } } if(cnt+cnt2<(H+W)*15)return 1; if(abs(cnt-cnt2)<40)return 4; if(GG>H*W*(M/2))return 2; return 3; }
#Verdict Execution timeMemoryGrader output
Fetching results...