# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
38510 | funcsr | Art Class (IOI13_artclass) | C++14 | 262 ms | 9576 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 <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <string>
#include <cassert>
#include <tuple>
using namespace std;
typedef pair<int, int> P;
#define rep(i, n) for (int i=0; i<(n); i++)
#define all(x) x.begin(), x.end()
#define uniq(x) x.erase(unique(all(x)), x.end())
#define pb push_back
#define INF 1005141919
#define _1 first
#define _2 second
int W, H;
int A[500][500];
vector<long long> f(int C) {
vector<long long> ret;
rep(lx, W-C+1) {
rep(ly, H-C+1) {
int avg = 0;
for (int x=lx; x<lx+C; x++) {
for (int y=ly; y<ly+C; y++) {
avg += A[x][y];
}
}
avg /= C*C;
long long s = 0;
for (int x=lx; x<lx+C; x++) {
for (int y=ly; y<ly+C; y++) {
s += 1LL*(A[x][y]-avg)*(A[x][y]-avg);
}
}
s /= C*C;
ret.pb(s);
}
}
sort(all(ret));
return ret;
}
int style(int HH, int WW, int R[500][500], int G[500][500], int B[500][500]) {
W = WW, H = HH;
rep(x, W) rep(y, H) A[x][y] = R[y][x]+G[y][x]+B[y][x];
vector<long long> a = f(3);
long long avg = 0;
for (long long x : a) avg += x;
avg /= a.size();
if (log2(avg) <= 9) return 4;
if (log2(a[a.size()/2]) <= 8) return 1;
a = f(10);
avg = 0;
for (long long x : a) avg += x;
avg /= a.size();
if (log2(avg) <= 13) return 2;
return 3;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |