Submission #776874

#TimeUsernameProblemLanguageResultExecution timeMemory
776874caganyanmazArt Class (IOI13_artclass)C++17
82 / 100
58 ms14136 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 vc = 0; int64_t hc = 0; array<int64_t,3> tc ({0, 0, 0}); for (int i = 0; i < H-1; i++) { for (int j = 0; j < W-1; j++) { int max_channel = -1; for (int c = 0; c < CHANNEL; c++) { if (max_channel == -1 || image[i][j][c] > image[i][j][max_channel]) max_channel = c; vc += abs(image[i][j][c] - image[i+1][j][c]); hc += abs(image[i][j][c] - image[i][j+1][c]); } tc[max_channel]++; } } int64_t total_size = H*W; int64_t change = vc + hc; int gb_ratio = (100 * tc[1]) / tc[2]; int difference = change / total_size; if (difference <= 15) return 4; if (difference > 90) return 3; if (gb_ratio > 400) return 2; return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...