제출 #557217

#제출 시각아이디문제언어결과실행 시간메모리
557217emuyumi미술 수업 (IOI13_artclass)C++17
100 / 100
76 ms4596 KiB
#include "artclass.h" #include <bits/stdc++.h> using namespace std; using ll = long long; ll adj_diff(int H, int W, int R[500][500], int G[500][500], int B[500][500]){ ll ret = 0; int lr = 0, lg = 0, lb = 0; for (int i = 0; i < H; ++i){ for (int j = 0; j < W; ++j){ ll cur = abs(R[i][j] - lr) + abs(G[i][j] - lg) + abs(B[i][j] - lb); ret += cur; lr = R[i][j], lg = G[i][j], lb = B[i][j]; } } return ret / H / W; } ll total_color(int H, int W, int R[500][500], int G[500][500], int B[500][500]){ ll ret = 0; for (int i = 0; i < H; ++i){ for (int j = 0; j < W; ++j){ ret += (R[i][j] + G[i][j] + B[i][j]) * (R[i][j] + G[i][j] + B[i][j]); } } return ret / H / W; } int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { ll diff = adj_diff(H, W, R, G, B); ll color = total_color(H, W, R, G, B); if (diff <= 8) return 4; if (diff >= 54) return 3; if (color >= 150'000) return 1; return 2; }
#Verdict Execution timeMemoryGrader output
Fetching results...