Submission #60904

#TimeUsernameProblemLanguageResultExecution timeMemory
60904adminArt Class (IOI13_artclass)C++14
76 / 100
148 ms6556 KiB
#include "artclass.h" #include <stdlib.h> #include <stdio.h> #include <memory.h> typedef long long ll; int R[500][500], G[500][500], B[500][500]; int cha (int x1, int y1, int x2, int y2) { return abs(R[x1][y1] - R[x2][y2]) + abs(G[x1][y1] - G[x2][y2]) + abs(B[x1][y1] - B[x2][y2]); } int count[13*13*13]; int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { int i, j; for(i = 0; i < H; i++) { for(j = 0; j < W; j++) { ::R[i][j] = R[i][j]; ::G[i][j] = G[i][j]; ::B[i][j] = B[i][j]; } } ll s1 = 0; for(i = 0; i < H; i++) { for(j = 0; j < W; j++) { if(i-1 >= 0) s1 += cha(i-1, j, i, j); if(j-1 >= 0) s1 += cha(i, j-1, i, j); } } if((double)s1/(H*W) >= 130) return 3; for(i = 0; i < H; i++) { for(j = 0; j < W; j++) { int c = (R[i][j]/30) * 8 * 8 + (G[i][j]/30) * 8 + (B[i][j]/30); ++count[c]; } } for(i=0; i<8*8*8; i++) if(count[i] >= H*W/4) return 4; memset(count, 0, sizeof count); for(i = 0; i < H; i++) { for(j = 0; j < W; j++) { int c = (R[i][j]/20) * 12 * 12 + (G[i][j]/20) * 12 + (B[i][j]/20); ++count[c]; } } for(i=0; i<13*13*13; i++) if(count[i] >= H*W/8) return 1; //printf("%d %lld %lf\n", H*W, s1, (double)s1/(H*W)); return 2; }
#Verdict Execution timeMemoryGrader output
Fetching results...