제출 #102862

#제출 시각아이디문제언어결과실행 시간메모리
102862wxh010910미술 수업 (IOI13_artclass)C++17
49 / 100
114 ms6140 KiB
#include <bits/stdc++.h> #include "artclass.h" using namespace std; int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { double diff = 0; for (int i = 0; i < H; ++i) { for (int j = 0; j < W; ++j) { int sumR = 0, sumG = 0, sumB = 0, cnt = 0; for (int x = i - 1; x <= i + 1; ++x) { for (int y = j - 1; y <= j + 1; ++y) { if (x >= 0 && x < H && y >= 0 && y < W) { sumR += R[x][y]; sumG += G[x][y]; sumB += B[x][y]; ++cnt; } } } double diffR = fabs(R[i][j] - (double) sumR / cnt); double diffG = fabs(G[i][j] - (double) sumG / cnt); double diffB = fabs(B[i][j] - (double) sumB / cnt); diff += diffR + diffG + diffB; } } diff /= 3 * H * W; if (diff >= 10) { return 3; } else if (diff < 1.8) { return 4; } else { return 1; } }
#Verdict Execution timeMemoryGrader output
Fetching results...