Submission #198139

#TimeUsernameProblemLanguageResultExecution timeMemory
198139johuthaArt Class (IOI13_artclass)C++17
43 / 100
130 ms6136 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[5] > 35e6) return 1; if (allog[0] < 1e6) return 4; if (allog[2] < 1e7) return 2; if (allog[9] > 4e7) return 1; return 3; }
#Verdict Execution timeMemoryGrader output
Fetching results...