Submission #198135

#TimeUsernameProblemLanguageResultExecution timeMemory
198135johuthaArt Class (IOI13_artclass)C++14
36 / 100
85 ms6176 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] > 4e7) return 1; return 3; }
#Verdict Execution timeMemoryGrader output
Fetching results...