Submission #7515

#TimeUsernameProblemLanguageResultExecution timeMemory
7515baneling100Art Class (IOI13_artclass)C++98
100 / 100
128 ms3696 KiB
#include "artclass.h" #include <stdlib.h> #include <stdio.h> double Red, Green, Blue, Color; int Dy[4]={0,1,0,-1}, Dx[4]={1,0,-1,0}; int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { int i, j, k, y, x; Red=Green=Blue=0; for(i=0 ; i<H ; i++) for(j=0 ; j<W ; j++) for(k=0 ; k<=3 ; k++) { y=i+Dy[k]; x=j+Dx[k]; if(y>=0 && y<H && x>=0 && x<W) { Red+=abs(R[y][x]-R[i][j]); Green+=abs(G[y][x]-G[i][j]); Blue+=abs(B[y][x]-B[i][j]); } } Red/=4.0*H*W; Green/=4.0*H*W; Blue/=4.0*H*W; Color=Red+Green+Blue; if(Color<=9) return 4; else if(Color>=54) return 3; else if(Color>=22) return 2; return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...