Submission #762203

#TimeUsernameProblemLanguageResultExecution timeMemory
762203SanguineChameleonArt Class (IOI13_artclass)C++17
32 / 100
44 ms3856 KiB
#include "artclass.h" #include <bits/stdc++.h> using namespace std; int A[16][3]; int E[4][16][3]; int style(int N, int M, int R[500][500], int G[500][500], int B[500][500]) { E[0][0][0] = 117813; E[0][0][1] = 169672; E[0][0][2] = 360823; E[0][1][0] = 91308; E[0][1][1] = 106136; E[0][1][2] = 112897; E[0][2][0] = 46490; E[0][2][1] = 43535; E[0][2][2] = 56880; E[0][3][0] = 37119; E[0][3][1] = 55920; E[0][3][2] = 138570; E[0][4][0] = 38837; E[0][4][1] = 183685; E[0][4][2] = 61306; E[0][5][0] = 37646; E[0][5][1] = 48412; E[0][5][2] = 17764; E[0][6][0] = 25764; E[0][6][1] = 22005; E[0][6][2] = 17492; E[0][7][0] = 10538; E[0][7][1] = 14175; E[0][7][2] = 20322; E[0][8][0] = 13135; E[0][8][1] = 30015; E[0][8][2] = 21224; E[0][9][0] = 50997; E[0][9][1] = 37497; E[0][9][2] = 26376; E[0][10][0] = 55379; E[0][10][1] = 58988; E[0][10][2] = 40409; E[0][11][0] = 68995; E[0][11][1] = 68395; E[0][11][2] = 89622; E[0][12][0] = 62152; E[0][12][1] = 78535; E[0][12][2] = 94235; E[0][13][0] = 171559; E[0][13][1] = 254204; E[0][13][2] = 186227; E[0][14][0] = 557953; E[0][14][1] = 453776; E[0][14][2] = 515995; E[0][15][0] = 677815; E[0][15][1] = 438550; E[0][15][2] = 303358; E[1][0][0] = 82449; E[1][0][1] = 54589; E[1][0][2] = 149467; E[1][1][0] = 117548; E[1][1][1] = 112931; E[1][1][2] = 340454; E[1][2][0] = 152239; E[1][2][1] = 133838; E[1][2][2] = 381834; E[1][3][0] = 182412; E[1][3][1] = 171352; E[1][3][2] = 262026; E[1][4][0] = 183406; E[1][4][1] = 218930; E[1][4][2] = 163002; E[1][5][0] = 171810; E[1][5][1] = 227343; E[1][5][2] = 103174; E[1][6][0] = 152013; E[1][6][1] = 203431; E[1][6][2] = 64168; E[1][7][0] = 136679; E[1][7][1] = 158114; E[1][7][2] = 49128; E[1][8][0] = 125171; E[1][8][1] = 119679; E[1][8][2] = 50690; E[1][9][0] = 111280; E[1][9][1] = 91378; E[1][9][2] = 53208; E[1][10][0] = 92923; E[1][10][1] = 90097; E[1][10][2] = 48118; E[1][11][0] = 84075; E[1][11][1] = 98055; E[1][11][2] = 38024; E[1][12][0] = 81082; E[1][12][1] = 45014; E[1][12][2] = 18113; E[1][13][0] = 47464; E[1][13][1] = 25158; E[1][13][2] = 28326; E[1][14][0] = 14409; E[1][14][1] = 6667; E[1][14][2] = 7258; E[1][15][0] = 22040; E[1][15][1] = 424; E[1][15][2] = 10; E[2][0][0] = 17070; E[2][0][1] = 25669; E[2][0][2] = 99799; E[2][1][0] = 35355; E[2][1][1] = 51710; E[2][1][2] = 75189; E[2][2][0] = 68775; E[2][2][1] = 73169; E[2][2][2] = 83366; E[2][3][0] = 81974; E[2][3][1] = 84130; E[2][3][2] = 91913; E[2][4][0] = 87336; E[2][4][1] = 94656; E[2][4][2] = 100960; E[2][5][0] = 92681; E[2][5][1] = 107064; E[2][5][2] = 108587; E[2][6][0] = 91993; E[2][6][1] = 114906; E[2][6][2] = 115142; E[2][7][0] = 92762; E[2][7][1] = 110131; E[2][7][2] = 114968; E[2][8][0] = 90783; E[2][8][1] = 98442; E[2][8][2] = 106538; E[2][9][0] = 87485; E[2][9][1] = 91896; E[2][9][2] = 96344; E[2][10][0] = 87184; E[2][10][1] = 86209; E[2][10][2] = 87742; E[2][11][0] = 88455; E[2][11][1] = 84645; E[2][11][2] = 79309; E[2][12][0] = 87342; E[2][12][1] = 78510; E[2][12][2] = 77952; E[2][13][0] = 87426; E[2][13][1] = 75898; E[2][13][2] = 61694; E[2][14][0] = 95467; E[2][14][1] = 86689; E[2][14][2] = 26618; E[2][15][0] = 141412; E[2][15][1] = 69776; E[2][15][2] = 7379; E[3][0][0] = 15187; E[3][0][1] = 124698; E[3][0][2] = 423033; E[3][1][0] = 100287; E[3][1][1] = 237104; E[3][1][2] = 239942; E[3][2][0] = 119306; E[3][2][1] = 121758; E[3][2][2] = 115918; E[3][3][0] = 102973; E[3][3][1] = 137541; E[3][3][2] = 198254; E[3][4][0] = 50208; E[3][4][1] = 123012; E[3][4][2] = 134949; E[3][5][0] = 63903; E[3][5][1] = 61074; E[3][5][2] = 69371; E[3][6][0] = 62329; E[3][6][1] = 159896; E[3][6][2] = 41105; E[3][7][0] = 5010; E[3][7][1] = 94781; E[3][7][2] = 28173; E[3][8][0] = 3218; E[3][8][1] = 67438; E[3][8][2] = 22061; E[3][9][0] = 15323; E[3][9][1] = 64954; E[3][9][2] = 100541; E[3][10][0] = 118759; E[3][10][1] = 67481; E[3][10][2] = 26805; E[3][11][0] = 140834; E[3][11][1] = 89382; E[3][11][2] = 15632; E[3][12][0] = 141169; E[3][12][1] = 34455; E[3][12][2] = 17455; E[3][13][0] = 216707; E[3][13][1] = 5516; E[3][13][2] = 15089; E[3][14][0] = 188796; E[3][14][1] = 9557; E[3][14][2] = 10622; E[3][15][0] = 128991; E[3][15][1] = 74353; E[3][15][2] = 14050; for (int i = 0; i < 16; i++) { for (int j = 0; j < 3; j++) { A[i][j] = 0; } } for (int i = 0; i < N; i++) { for (int j = 0; j < M; j++) { A[R[i][j] / 16][0]++; A[G[i][j] / 16][1]++; A[B[i][j] / 16][2]++; } } pair<long double, int> res = make_pair(1e18L, -1); for (int X = 0; X < 4; X++) { long double score = 0.0L; for (int i = 0; i < 3; i++) { int totA = 0; int totE = 0; for (int j = 0; j < 16; j++) { totA += A[j][i]; totE += E[X][j][i]; } for (int j = 0; j < 16; j++) { long double exp = 1.0L * E[X][j][i] / totE * totA; score += (exp - A[j][i]) * (exp - A[j][i]) / exp; } } res = min(res, make_pair(score, X + 1)); } return res.second; }
#Verdict Execution timeMemoryGrader output
Fetching results...