Submission #762208

#TimeUsernameProblemLanguageResultExecution timeMemory
762208SanguineChameleonArt Class (IOI13_artclass)C++17
62 / 100
61 ms3316 KiB
#include "artclass.h" #include <bits/stdc++.h> using namespace std; const int BLOCK = 8; int A[BLOCK][BLOCK][BLOCK]; vector<int> E = {184340,1272,1590,1529,195,0,0,0,7692,418,330,315,1304,1091,0,0,0,2,6,0,188,3870,1365,0,0,0,0,0,2,171,3119,121,0,0,0,0,0,21,124,56,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,23496,1873,429,422,109,0,0,0,11910,13812,1932,1970,2344,496,0,0,643,1653,493,492,2089,10365,31,0,0,0,2,67,132,2832,948,5,0,0,0,0,0,1677,3198,0,0,0,0,0,0,0,187,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1081,199,209,109,4,0,0,0,2562,9918,2593,1231,258,2183,0,0,4216,5208,9438,3419,5203,13902,183,0,2,231,1033,445,1489,2942,335,0,0,0,0,2,17,1006,4703,0,0,0,0,0,0,3,2331,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,780,349,220,11,0,0,0,0,357,1291,305,137,29,507,0,0,2370,660,2560,1273,635,9312,2775,0,581,677,2196,4453,1121,1230,52,0,0,6,144,933,247,329,269,0,0,0,0,0,1,80,354,55,0,0,0,0,0,0,1,2,0,0,0,0,0,0,0,0,22079,621,87,0,0,0,0,0,3567,1018,242,30,0,0,0,0,238,418,641,155,19,0,0,0,2050,674,468,1619,646,74,5,2,147,272,552,4267,5490,1764,186,0,0,3,11,289,5473,7690,3066,105,0,0,0,0,0,0,60,104,0,0,0,0,0,0,0,0,6757,1001,3,0,0,0,0,0,3127,1698,228,9,0,0,0,0,244,921,1434,156,3,0,0,0,2698,306,266,398,100,3,0,0,14258,1076,413,1742,2155,1041,37,0,8,73,386,1492,8731,35298,24573,54,0,0,1,18,69,1325,11647,592,0,0,0,0,0,0,0,33,14634,2016,0,0,0,0,0,0,3686,3188,40,1,0,0,0,0,556,1627,1377,62,0,0,0,0,183,193,600,645,146,0,0,0,16631,571,576,530,876,271,2,0,1278,619,1316,1461,1674,5128,2076,5,11,169,426,536,636,5945,88513,28215,0,0,2,6,4,20,9022,38238,10327,64,2,0,0,0,0,0,2383,15172,81,0,0,0,0,0,160,104981,36753,1,0,0,0,0,148,139,491,139,1,0,0,0,357,662,205,319,320,60,0,0,15649,3576,1144,906,681,1446,131,0,53141,11368,4448,2556,1446,11582,47494,62434,59373,5455,3397,3669,3763,6367,73675,689302,116741,2535,4,0,0,0,0,0,42627,20860,205,0,0,0,0,0,307,12610,4060,1,0,0,0,0,0,6,41,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,41897,3057,2,0,0,0,0,0,94375,56371,364,5,0,0,0,0,24452,75743,21470,88,0,0,0,0,162,2090,13260,1274,0,0,0,0,0,1,0,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2791,133,0,0,0,0,0,0,48538,29325,646,15,0,0,0,0,53794,112395,18499,187,10,0,0,0,3461,39169,33781,8099,48,1,0,0,1,708,616,2920,75,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,311,9,0,0,0,0,0,0,6646,3856,29,0,0,0,0,0,26020,63352,8556,334,4,0,0,0,8830,84280,44464,10656,351,82,0,0,203,5257,10911,10840,2987,228,0,0,2,10,30,97,339,7,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,39,0,0,0,0,0,0,0,891,408,2,0,0,0,0,0,5473,14890,2200,38,0,0,0,0,7425,57062,26168,4311,257,1,0,0,1044,20990,33780,23372,12869,2156,193,0,26,333,935,2766,14565,2439,1717,0,0,3,4,26,25,42,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,11,15,0,0,0,0,0,0,220,1365,110,0,0,0,0,0,1297,8077,4418,498,6,0,0,0,1658,21909,24961,13869,2964,210,0,0,133,1499,5068,17073,30621,26476,7752,339,7,48,122,345,794,2070,2491,543,0,0,0,5,4,11,8,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,24,68,1,0,0,0,0,0,107,871,694,33,0,0,0,0,112,1489,3275,2841,288,0,0,0,108,1936,3968,6379,15720,30142,741,0,36,168,411,810,3371,21440,29540,2914,5,20,26,89,231,56,457,174,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,30,182,53,0,0,0,0,0,41,312,1796,3735,2406,0,0,0,46,232,636,2078,13924,11,0,0,19,154,356,253,1895,649,1131,503,8,61,254,217,142,120,2408,2795,48255,1088,4,0,0,0,0,0,2302,769,5,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25811,715,0,0,0,0,0,0,48919,61915,5101,7,0,0,0,0,193,4552,3409,58,0,0,0,0,0,0,26,43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,931,176,5,0,0,0,0,0,12169,16050,2509,25,0,0,0,0,2941,52371,67552,12375,22,0,0,0,1,948,7576,4070,90,1,0,0,0,0,11,131,60,1,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,180,48,6,0,0,0,0,0,2511,1284,1219,36,0,0,0,0,2198,10937,21509,5345,21,0,0,0,202,4806,53949,62359,6313,45,0,0,0,2,664,5924,3110,92,0,0,0,0,0,50,1341,584,0,0,0,0,0,0,0,19,1,0,0,0,0,0,0,0,0,0,46,5,4,0,0,0,0,0,781,322,589,41,0,0,0,0,1593,3079,3649,2796,17,0,0,0,565,3618,15660,27964,3389,7,0,0,22,412,5449,51642,46408,2260,3,0,0,0,2,206,3984,2915,53,0,0,0,0,0,6,617,164,0,0,0,0,0,0,0,0,0,36,0,0,0,0,0,0,0,413,53,11,0,0,0,0,0,1532,1281,777,823,5,0,0,0,928,1945,3249,4780,2054,4,0,0,243,1238,5201,21660,28377,1420,1,0,1,50,672,6844,50116,37308,798,0,0,0,0,0,84,2651,1031,7,0,0,0,0,0,0,31,15,68,0,0,0,0,0,0,0,217,18,0,0,0,0,0,0,1509,596,29,7,0,0,0,0,3625,1111,968,579,236,0,0,0,363,1225,1967,4723,3764,408,0,0,111,768,2487,7585,26484,22778,451,0,1,28,327,1541,10121,50377,28552,387,0,0,0,0,0,34,1116,207,1,0,0,0,0,0,0,0,31,2,0,0,0,0,0,0,320,218,4,0,0,0,0,0,13551,259,112,4,0,0,0,0,1794,1034,382,255,85,7,0,0,224,829,1012,1102,1431,617,49,0,400,1486,3044,5054,9121,22402,16766,221,0,39,407,2081,6243,22502,90630,33160,10685,630,0,0,0,0,0,0,5005,61302,571,2,0,0,0,0,0,9972,1353,0,5510,0,0,0,0,0,0,0,20442,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,30097,527,0,0,0,0,0,0,118,65327,10353,7939,0,0,0,0,0,7891,11636,17818,3634,0,0,0,0,0,32,11,61233,5657,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,91254,261,0,0,0,0,0,0,4054,1843,200,2,0,0,0,0,0,796,1439,4237,1285,0,0,0,0,0,3,645,2822,4274,0,0,0,0,0,0,5,991,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,50652,7234,0,0,0,0,0,0,4958,1226,0,0,0,0,0,0,1,368,372,174,0,0,0,0,0,5,548,994,708,25,0,0,0,0,0,0,56,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5330,2131,0,0,0,0,0,0,790,1437,0,0,0,0,0,0,46,296,310,56,0,0,0,0,143,129,1441,1434,336,0,0,0,560,172,68,275,3077,479,0,0,0,0,0,0,2,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,33506,348,0,0,0,0,0,0,35917,2878,120,0,0,0,0,0,1121,1513,18716,4,0,0,0,0,692,17907,69144,9320,41,0,0,0,18483,7627,23115,3595,4747,3313,1,0,62,370,253,209,593,2172,180,0,0,0,0,0,3,1084,2499,14,0,0,0,0,0,0,4,42,96747,40,0,0,0,0,0,0,11964,2,121,0,0,0,0,0,9306,2647,14249,68,0,0,0,0,1501,30706,18244,1072,0,0,0,0,15177,11968,15868,12860,236,27,0,0,36707,52905,7182,3824,2515,590,0,0,251,399,886,1007,2583,4590,1370,1,0,0,0,0,0,1,119,143,31220,1135,5,0,0,0,0,0,42755,392,23,0,0,0,0,0,69265,3,0,0,0,0,0,0,5003,29,0,4,130,0,0,0,9296,25,17,3,42,266,19,0,27299,15602,5498,91,140,350,290,0,12955,6006,2296,1964,1223,423,188,229,55,123,257,1670,11239,18140,27874,24243,}; 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 timeMemoryGrader output
Fetching results...