# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
762215 | SanguineChameleon | Art Class (IOI13_artclass) | C++17 | 50 ms | 3316 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 <bits/stdc++.h>
using namespace std;
const int BLOCK = 2;
int A[BLOCK][BLOCK][BLOCK];
vector<int> E = {316802,72937,1085,14691,252802,999,215365,1188819,1142783,496,31638,3639,136985,264,201847,239348,549462,6492,6782,5210,99769,5712,133911,526162,412535,105592,0,1076,541230,507,296980,115080,};
int style(int N, int M, int R[500][500], int G[500][500], int B[500][500]) {
for (int r = 0; r < BLOCK; r++) {
for (int g = 0; g < BLOCK; g++) {
for (int b = 0; b < BLOCK; b++) {
A[r][g][b] = 1;
}
}
}
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
A[R[i][j] / (256 / BLOCK)][G[i][j] / (256 / BLOCK)][B[i][j] / (256 / BLOCK)]++;
}
}
pair<long double, int> res = make_pair(1e18L, -1);
for (int X = 0; X < 4; X++) {
long double score = 0.0L;
int totA = 0;
int totE = 0;
for (int r = 0; r < BLOCK; r++) {
for (int g = 0; g < BLOCK; g++) {
for (int b = 0; b < BLOCK; b++) {
totA += A[r][g][b];
totE += E[X * BLOCK * BLOCK * BLOCK + r * BLOCK * BLOCK + g * BLOCK + b] + 1;
}
}
}
for (int r = 0; r < BLOCK; r++) {
for (int g = 0; g < BLOCK; g++) {
for (int b = 0; b < BLOCK; b++) {
long double exp = 1.0L * (E[X * BLOCK * BLOCK * BLOCK + r * BLOCK * BLOCK + g * BLOCK + b] + 1) / totE * totA;
score += (exp - A[r][g][b]) * (exp - A[r][g][b]) / exp;
}
}
}
res = min(res, make_pair(score, X + 1));
}
return res.second;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |