Submission #440980

#TimeUsernameProblemLanguageResultExecution timeMemory
440980NamnamseoArt Class (IOI13_artclass)C++17
100 / 100
69 ms6040 KiB
#include "artclass.h" using namespace std; const float coeff[4][3*4*4+3] = {{ -63.0400, -29.9633, -30.4937, 139.9450, -133.5472, 75.6406, 4.1946, 92.0297, -7.4521, 67.0902, -40.1558, -96.8360, 30.4891, -61.8195, 29.1258, -114.8488, 180.2290, -62.8737, 40.4461, -134.5308, 12.7274, -70.8499, -18.0083, 144.1649, 161.6808, -2.9197, 0.6342, -204.6375, 18.8772, 134.2941, 102.3418, 30.7536, -178.6157, -98.2650, -119.1426, 262.0974, -41.6917, -20.1880, 27.1856, -81.1678, 161.6122, -125.1560, 67.7421, 52.9095, -56.8205, 93.8830, 10.6928, -158.8677, 24.0739, -138.4683, 93.5732}, { 39.2376, 251.2074, -209.7736, -200.1912, 260.1740, -115.3471, -208.2322, 218.9643, -52.4071, 23.7714, 265.8700, -174.4878, -46.6126, -229.2821, 175.5157, -154.5625, -0.3871, 232.1231, 126.8237, -219.3655, 93.0219, 211.2868, -227.5675, 23.1429, 120.5473, -111.1882, 54.8543, -161.6028, 220.9912, -247.8992, 125.2693, 159.3035, -7.7914, 63.2907, -255.2971, -236.0402, -245.1792, 206.8028, 3.2134, -43.4771, 38.2679, -14.9989, 56.1295, -218.6725, 246.3542, 41.0153, -14.1745, 173.7840, -173.8779, 297.9964, -256.6154}, { 123.7566, 80.2844, -200.7963, -174.1101, 100.0404, 82.7393, -82.9470, -199.4397, 243.1159, 97.3223, 45.5022, -103.7382, -142.5100, 94.3229, 18.3019, 169.9270, -177.5642, 7.8294, -142.6725, 84.9434, 144.3373, 18.7439, 158.3002, -234.7830, -59.5506, -25.6033, 88.6889, 231.9213, 19.9985, -195.3839, 52.8407, -114.7098, 28.7682, 56.6459, 172.2831, -204.4079, 2.0981, -63.1707, 32.3486, 101.2075, -172.0590, 34.3549, -37.3782, -124.5983, 159.1983, -162.2696, 44.7576, 125.7577, -76.8405, 78.4085, -42.2169}, { -66.3745, -102.2115, 224.5301, 76.2889, -23.8942, -176.6279, 119.3946, 129.0869, -251.9080, -175.8489, -121.1599, 217.4591, 144.9682, 9.7203, -91.4585, -86.0869, -43.0534, 75.5384, 128.1504, 113.8718, -180.1230, 70.4334, -159.6553, 183.9166, -144.6375, 49.8998, -107.8242, -69.5453, -62.0033, 153.6426, -191.2019, 79.3045, 205.9442, 87.3162, -3.8528, -225.4161, 110.5283, 83.2811, -82.4912, -21.9167, -7.6361, 147.5880, -48.4723, 118.7705, -184.1634, 93.6264, -71.1094, 81.8497, 70.1424, -143.5856, 28.5372}}; int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) { float key[3*4*4+3]; int (*(img[3]))[500] = {R, G, B}; for (int i=0; i<3; ++i) { long long t = 0; for (int j=0; j<H; ++j) for (int k=0; k<W; ++k) { t += img[i][j][k]; } key[3*4*4 + i] = (t / (H*W)) / 255.0; } for (int t=0, i=0; i<4; ++i) for (int j=0; j<4; ++j) for (int c=0; c<3; ++c) { key[t++] = img[c][i][j] / 255.0; } double ans[4]; for (int i=0; i<4; ++i) { ans[i] = 0; for (int j=0; j<3*4*4+3; ++j) { ans[i] += coeff[i][j] * key[j]; } } int mi = 0; for (int i=1; i<4; ++i) if (ans[mi] < ans[i]) mi = i; return mi+1; }

Compilation message (stderr)

artclass.cpp: In function 'int style(int, int, int (*)[500], int (*)[500], int (*)[500])':
artclass.cpp:43:11: warning: unnecessary parentheses in declaration of 'img' [-Wparentheses]
   43 |     int (*(img[3]))[500] = {R, G, B};
      |           ^
#Verdict Execution timeMemoryGrader output
Fetching results...