Submission #769631

#TimeUsernameProblemLanguageResultExecution timeMemory
769631fve5Art Class (IOI13_artclass)C++17
82 / 100
46 ms6168 KiB
#include <bits/stdc++.h> #include "artclass.h" using namespace std; int diff(array<int, 3> a, array<int, 3> b) { return abs(a[0] - b[0]) + abs(a[1] - b[1]) + abs(a[2] - b[2]); } int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { double difference = 0.; array<int, 3> img[500][500]; for (int i = 0; i < H; i++) for (int j = 0; j < H; j++) img[i][j] = { R[i][j], G[i][j], B[i][j] }; for (int i = 1; i < H - 1; i++) { for (int j = 1; j < W - 1; j++) { difference += diff(img[i][j], img[i - 1][j - 1]) + diff(img[i][j], img[i - 1][j ]) + diff(img[i][j], img[i - 1][j + 1]) + diff(img[i][j], img[i ][j + 1]) + diff(img[i][j], img[i + 1][j + 1]) + diff(img[i][j], img[i + 1][j ]) + diff(img[i][j], img[i + 1][j - 1]) + diff(img[i][j], img[i ][j - 1]); } } difference /= (H * W); if (difference <= 75) return 4; if (difference >= 400) return 3; int cnt = 0; for (int i = 0; i < H; i++) { for (int j = 0; j < H; j++) { if (R[i][j] > 230) { cnt++; } } } if ((double)cnt / (H * W) > 0.05) return 1; return 2; }
#Verdict Execution timeMemoryGrader output
Fetching results...