# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
762222 | SanguineChameleon | Art Class (IOI13_artclass) | C++17 | 53 ms | 3320 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 = 5;
const int BLOCK_SIZE = (255 / BLOCK_CNT) + 1;
int A[BLOCK_CNT][BLOCK_CNT][BLOCK_CNT];
vector<int> E = {231661,4780,3853,353,0,3430,669,2066,13191,293,0,0,12,2255,1458,0,0,0,70,53,0,0,0,0,0,8390,3346,744,14,0,14511,27991,12238,39024,0,20,1359,789,9401,38,0,0,0,3778,1312,0,0,0,0,0,19933,859,20,0,0,3414,4368,1474,2261,5,2303,3697,11092,2053,17,3,45,4677,7966,820,0,0,0,0,1,27287,478,0,0,0,2421,4092,222,2,0,33470,1615,4231,1051,1,452,1452,13322,81625,19416,0,3,19,1732,11175,26500,328,0,0,0,33320,127518,10,0,0,1913,1241,1305,158,0,35462,7038,4575,25104,9255,110235,11359,8344,41926,961736,260732,774,0,0,0,89892,43365,26,0,0,16,841,9,0,0,0,0,0,0,0,0,0,0,0,0,75163,1051,1,0,0,303600,109951,196,1,0,19214,55088,7914,8,0,0,3,38,0,0,0,0,0,0,0,1928,4,0,0,0,94971,39066,322,0,0,72577,148502,37461,2461,0,228,2164,16478,4194,389,0,0,3,8,0,18,0,0,0,0,2996,1969,10,0,0,24833,55467,10233,166,0,2426,19569,65974,84652,12246,25,104,462,1448,1850,0,0,0,0,0,46,11,0,0,0,462,3534,5938,0,0,401,3749,22173,19050,200,118,696,826,5800,20909,132119,2950,2,0,0,3844,2368,1,0,0,0,0,3,0,0,0,0,0,0,0,0,0,0,0,0,31247,2121,0,0,0,65736,164347,12181,0,0,13,7917,4366,8,0,0,0,25,12,0,0,0,0,0,0,1304,478,0,0,0,11384,40360,6987,0,0,1831,78292,141540,2763,0,0,12,5652,4651,3,0,0,0,17,4,371,1,0,0,0,5495,3391,1463,0,0,3718,17155,56469,2015,0,231,4484,86073,100969,529,0,0,6,1737,550,103,0,0,0,0,4059,274,1,0,0,16892,2052,1813,66,0,2098,6714,21329,38558,297,266,3333,14730,117412,94308,85020,11097,0,0,0,16896,57654,67411,116,0,0,0,13525,13145,0,0,0,0,0,0,0,0,0,0,0,156641,393,0,0,0,1099,35460,21622,0,0,0,0,3690,12167,0,0,0,0,0,0,0,0,0,0,0,25994,0,0,0,0,350,1927,488,0,0,395,1069,3535,538,0,0,0,0,30,0,0,0,0,0,0,77994,90,0,0,0,15116,64828,142,0,0,34993,152553,13064,4029,0,22510,6348,5387,10697,84,0,0,1,194,214,156155,173,0,0,0,104528,100,19,0,0,19744,1137,611,284,0,100694,51577,6208,4127,120,1302,1884,12990,33498,39343,};
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... |