Submission #776407

#TimeUsernameProblemLanguageResultExecution timeMemory
776407caganyanmazArt Class (IOI13_artclass)C++17
87 / 100
60 ms6928 KiB
#include "artclass.h" #include <bits/stdc++.h> using namespace std; constexpr static int MXSIZE = 500; constexpr static int CHANNEL = 3; array<int, 3> image[MXSIZE][MXSIZE]; int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { for (int i = 0; i < H; i++) for (int j = 0; j < W; j++) image[i][j] = {R[i][j], G[i][j], B[i][j]}; int64_t change = 0; for (int i = 0; i < H-1; i++) for (int j = 0; j < W-1; j++) for (int c = 0; c < CHANNEL; c++) change += abs(image[i][j][c] - image[i][j+1][c]) + abs(image[i][j][c] - image[i+1][j][c]); int64_t total_size = H*W; int difference = change / total_size; if (difference <= 15) return 4; else if (difference <= 50) return 1; else if (difference <= 90) return 2; return 3; }
#Verdict Execution timeMemoryGrader output
Fetching results...