# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
762219 | SanguineChameleon | Art Class (IOI13_artclass) | C++17 | 57 ms | 3264 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_CNT = 3;
const int BLOCK_SIZE = (255 / BLOCK_CNT) + 1;
int A[BLOCK_CNT][BLOCK_CNT][BLOCK_CNT];
vector<int> E = {277781,21755,5642,1243,7103,29598,0,0,47,45511,5571,22432,12543,46584,14942,6,2778,15977,202871,156,0,47556,10098,1862,149871,29218,1112355,653435,464,0,110221,20556,0,0,0,0,123792,447,0,412625,144906,3337,440,11732,4890,137,0,0,35958,48481,1846,4527,85318,93888,300949,10969,0,8564,4670,0,0,0,0,45010,8763,0,92082,330763,1698,1,5000,3099,2529,159,0,35326,73964,1159,6626,133980,268189,265078,36792,0,3074,100922,2396,0,0,0,180131,83,0,16661,19261,902,0,3,16,290694,35,0,266220,62791,1080,118370,34327,74164,};
int style(int N, int M, int R[500][500], int G[500][500], int B[500][500]) {
for (int r = 0; r < BLOCK_CNT; r++) {
for (int g = 0; g < BLOCK_CNT; g++) {
for (int b = 0; b < BLOCK_CNT; b++) {
A[r][g][b] = 1;
}
}
}
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
A[R[i][j] / BLOCK_SIZE][G[i][j] / BLOCK_SIZE][B[i][j] / BLOCK_SIZE]++;
}
}
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_CNT; r++) {
for (int g = 0; g < BLOCK_CNT; g++) {
for (int b = 0; b < BLOCK_CNT; b++) {
totA += A[r][g][b];
totE += E[X * BLOCK_CNT * BLOCK_CNT * BLOCK_CNT + r * BLOCK_CNT * BLOCK_CNT + g * BLOCK_CNT + b] + 1;
}
}
}
for (int r = 0; r < BLOCK_CNT; r++) {
for (int g = 0; g < BLOCK_CNT; g++) {
for (int b = 0; b < BLOCK_CNT; b++) {
long double exp = 1.0L * (E[X * BLOCK_CNT * BLOCK_CNT * BLOCK_CNT + r * BLOCK_CNT * BLOCK_CNT + g * BLOCK_CNT + 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... |