제출 #198133

#제출 시각아이디문제언어결과실행 시간메모리
198133johutha미술 수업 (IOI13_artclass)C++14
36 / 100
108 ms6248 KiB
#include "artclass.h" #include <iostream> #include <cmath> #include <vector> using namespace std; int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { int cs = 1; vector<int> allog(9); for (int logger = 0; logger < 9; logger++) { cs *= 2; int cnt = ceil(500.0/(double)cs); int diff = 0; for (int i = 0; i < cnt; i++) { for (int j = 0; j < cnt; j++) { int avgr = 0; int avgg = 0; int avgb = 0; int ccn = 0; for (int x = i * cs; x < min((i + 1)*cs, W); x++) { for (int y = i * cs; y < min((i + 1)*cs, H); y++) { avgr += R[x][y]; avgg += G[x][y]; avgb += B[x][y]; ccn++; } } if (ccn == 0) continue; avgr /= ccn; avgg /= ccn; avgb /= ccn; for (int x = i * cs; x < min((i + 1)*cs, W); x++) { for (int y = i * cs; y < min((i + 1)*cs, H); y++) { diff += abs(R[x][y] - avgr); diff += abs(G[x][y] - avgg); diff += abs(B[x][y] - avgb); } } } } allog[logger] = diff; } if (allog[0] < 1e6) return 4; if (allog[2] < 1e7) return 2; if (allog[9] < 35e6) return 3; return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...