Submission #776937

#TimeUsernameProblemLanguageResultExecution timeMemory
776937caganyanmazArt Class (IOI13_artclass)C++17
87 / 100
54 ms7332 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]; constexpr static int MINDIFF = 10; 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}); double sum_y = 0; for (int i = 0; i < H-1; i++) { for (int j = 0; j < W-1; j++) { for (int c = 0; c < CHANNEL; c++) { vc += abs(image[i][j][c] - image[i+1][j][c]); hc += abs(image[i][j][c] - image[i][j+1][c]); } double y = 0.299 * image[i][j][0] + 0.587 * image[i][j][1] + 0.114 * image[i][j][2]; sum_y += y; } } int64_t total_size = H*W; int64_t change = vc + hc; int difference = change / total_size; double average_y = sum_y / total_size; /* double d_c = 45, d_f = 1; double gb_c = 4, gb_f = 4; double d = (difference - d_c) * d_f; // Negative for likely 1, positive for likely 2 double gb_raw = ((double) (tc[1]))/ tc[2]+1; double gb = (gb_raw - gb_c) * gb_f; cout << tc[0] << " " << tc[1] << " " << tc[2] << "\n"; cout << d << " " << gb_raw << " " << tc[2] << "\n"; */ if (difference <= 15) return 4; if (difference > 90) return 3; if (average_y >= 130) return 1; return 2; }
#Verdict Execution timeMemoryGrader output
Fetching results...