# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
198133 | johutha | Art Class (IOI13_artclass) | C++14 | 108 ms | 6248 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |