# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
762190 | SanguineChameleon | Art Class (IOI13_artclass) | C++17 | 52 ms | 3580 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;
int A[10][10][3];
int C[4][10][10][3];
int style(int N, int M, int R[500][500], int G[500][500], int B[500][500]) {
C[0][0][0][0] = 150;
C[0][0][0][1] = 138;
C[0][0][0][2] = 123;
C[0][0][1][0] = 181;
C[0][0][1][1] = 159;
C[0][0][1][2] = 142;
C[0][0][2][0] = 162;
C[0][0][2][1] = 147;
C[0][0][2][2] = 142;
C[0][0][3][0] = 173;
C[0][0][3][1] = 137;
C[0][0][3][2] = 124;
C[0][0][4][0] = 181;
C[0][0][4][1] = 154;
C[0][0][4][2] = 131;
C[0][0][5][0] = 193;
C[0][0][5][1] = 155;
C[0][0][5][2] = 111;
C[0][0][6][0] = 177;
C[0][0][6][1] = 131;
C[0][0][6][2] = 94;
C[0][0][7][0] = 168;
C[0][0][7][1] = 129;
C[0][0][7][2] = 107;
C[0][0][8][0] = 148;
C[0][0][8][1] = 108;
C[0][0][8][2] = 95;
C[0][0][9][0] = 109;
C[0][0][9][1] = 73;
C[0][0][9][2] = 39;
C[0][1][0][0] = 155;
C[0][1][0][1] = 143;
C[0][1][0][2] = 135;
C[0][1][1][0] = 191;
C[0][1][1][1] = 172;
C[0][1][1][2] = 167;
C[0][1][2][0] = 181;
C[0][1][2][1] = 171;
C[0][1][2][2] = 171;
C[0][1][3][0] = 214;
C[0][1][3][1] = 183;
C[0][1][3][2] = 167;
C[0][1][4][0] = 218;
C[0][1][4][1] = 191;
C[0][1][4][2] = 162;
C[0][1][5][0] = 217;
C[0][1][5][1] = 194;
C[0][1][5][2] = 175;
C[0][1][6][0] = 168;
C[0][1][6][1] = 146;
C[0][1][6][2] = 139;
C[0][1][7][0] = 167;
C[0][1][7][1] = 130;
C[0][1][7][2] = 127;
C[0][1][8][0] = 142;
C[0][1][8][1] = 105;
C[0][1][8][2] = 101;
C[0][1][9][0] = 111;
C[0][1][9][1] = 75;
C[0][1][9][2] = 43;
C[0][2][0][0] = 162;
C[0][2][0][1] = 151;
C[0][2][0][2] = 133;
C[0][2][1][0] = 181;
C[0][2][1][1] = 170;
C[0][2][1][2] = 159;
C[0][2][2][0] = 189;
C[0][2][2][1] = 171;
C[0][2][2][2] = 167;
C[0][2][3][0] = 205;
C[0][2][3][1] = 174;
C[0][2][3][2] = 160;
C[0][2][4][0] = 213;
C[0][2][4][1] = 183;
C[0][2][4][2] = 138;
C[0][2][5][0] = 217;
C[0][2][5][1] = 185;
C[0][2][5][2] = 155;
C[0][2][6][0] = 195;
C[0][2][6][1] = 171;
C[0][2][6][2] = 147;
C[0][2][7][0] = 173;
C[0][2][7][1] = 147;
C[0][2][7][2] = 136;
C[0][2][8][0] = 161;
C[0][2][8][1] = 120;
C[0][2][8][2] = 108;
C[0][2][9][0] = 116;
C[0][2][9][1] = 75;
C[0][2][9][2] = 60;
C[0][3][0][0] = 153;
C[0][3][0][1] = 146;
C[0][3][0][2] = 135;
C[0][3][1][0] = 177;
C[0][3][1][1] = 169;
C[0][3][1][2] = 169;
C[0][3][2][0] = 184;
C[0][3][2][1] = 158;
C[0][3][2][2] = 165;
C[0][3][3][0] = 197;
C[0][3][3][1] = 169;
C[0][3][3][2] = 165;
C[0][3][4][0] = 209;
C[0][3][4][1] = 183;
C[0][3][4][2] = 147;
C[0][3][5][0] = 213;
C[0][3][5][1] = 190;
C[0][3][5][2] = 159;
C[0][3][6][0] = 187;
C[0][3][6][1] = 168;
C[0][3][6][2] = 153;
C[0][3][7][0] = 175;
C[0][3][7][1] = 156;
C[0][3][7][2] = 148;
C[0][3][8][0] = 156;
C[0][3][8][1] = 120;
C[0][3][8][2] = 116;
C[0][3][9][0] = 125;
C[0][3][9][1] = 79;
C[0][3][9][2] = 69;
C[0][4][0][0] = 183;
C[0][4][0][1] = 171;
C[0][4][0][2] = 157;
C[0][4][1][0] = 201;
C[0][4][1][1] = 194;
C[0][4][1][2] = 185;
C[0][4][2][0] = 190;
C[0][4][2][1] = 169;
C[0][4][2][2] = 156;
C[0][4][3][0] = 205;
C[0][4][3][1] = 175;
C[0][4][3][2] = 156;
C[0][4][4][0] = 216;
C[0][4][4][1] = 192;
C[0][4][4][2] = 168;
C[0][4][5][0] = 221;
C[0][4][5][1] = 196;
C[0][4][5][2] = 166;
C[0][4][6][0] = 176;
C[0][4][6][1] = 156;
C[0][4][6][2] = 145;
C[0][4][7][0] = 159;
C[0][4][7][1] = 141;
C[0][4][7][2] = 134;
C[0][4][8][0] = 158;
C[0][4][8][1] = 130;
C[0][4][8][2] = 115;
C[0][4][9][0] = 115;
C[0][4][9][1] = 81;
C[0][4][9][2] = 66;
C[0][5][0][0] = 167;
C[0][5][0][1] = 157;
C[0][5][0][2] = 130;
C[0][5][1][0] = 194;
C[0][5][1][1] = 182;
C[0][5][1][2] = 163;
C[0][5][2][0] = 178;
C[0][5][2][1] = 156;
C[0][5][2][2] = 147;
C[0][5][3][0] = 196;
C[0][5][3][1] = 167;
C[0][5][3][2] = 153;
C[0][5][4][0] = 212;
C[0][5][4][1] = 184;
C[0][5][4][2] = 176;
C[0][5][5][0] = 218;
C[0][5][5][1] = 189;
C[0][5][5][2] = 167;
C[0][5][6][0] = 165;
C[0][5][6][1] = 146;
C[0][5][6][2] = 137;
C[0][5][7][0] = 141;
C[0][5][7][1] = 121;
C[0][5][7][2] = 118;
C[0][5][8][0] = 142;
C[0][5][8][1] = 118;
C[0][5][8][2] = 113;
C[0][5][9][0] = 131;
C[0][5][9][1] = 104;
C[0][5][9][2] = 92;
C[0][6][0][0] = 172;
C[0][6][0][1] = 159;
C[0][6][0][2] = 135;
C[0][6][1][0] = 189;
C[0][6][1][1] = 179;
C[0][6][1][2] = 168;
C[0][6][2][0] = 193;
C[0][6][2][1] = 154;
C[0][6][2][2] = 140;
C[0][6][3][0] = 206;
C[0][6][3][1] = 166;
C[0][6][3][2] = 153;
C[0][6][4][0] = 205;
C[0][6][4][1] = 178;
C[0][6][4][2] = 165;
C[0][6][5][0] = 197;
C[0][6][5][1] = 171;
C[0][6][5][2] = 165;
C[0][6][6][0] = 170;
C[0][6][6][1] = 143;
C[0][6][6][2] = 127;
C[0][6][7][0] = 147;
C[0][6][7][1] = 118;
C[0][6][7][2] = 101;
C[0][6][8][0] = 158;
C[0][6][8][1] = 128;
C[0][6][8][2] = 117;
C[0][6][9][0] = 131;
C[0][6][9][1] = 102;
C[0][6][9][2] = 91;
C[0][7][0][0] = 162;
C[0][7][0][1] = 153;
C[0][7][0][2] = 143;
C[0][7][1][0] = 186;
C[0][7][1][1] = 182;
C[0][7][1][2] = 179;
C[0][7][2][0] = 183;
C[0][7][2][1] = 153;
C[0][7][2][2] = 141;
C[0][7][3][0] = 209;
C[0][7][3][1] = 169;
C[0][7][3][2] = 150;
C[0][7][4][0] = 194;
C[0][7][4][1] = 182;
C[0][7][4][2] = 169;
C[0][7][5][0] = 196;
C[0][7][5][1] = 182;
C[0][7][5][2] = 165;
C[0][7][6][0] = 168;
C[0][7][6][1] = 153;
C[0][7][6][2] = 125;
C[0][7][7][0] = 157;
C[0][7][7][1] = 140;
C[0][7][7][2] = 119;
C[0][7][8][0] = 164;
C[0][7][8][1] = 144;
C[0][7][8][2] = 119;
C[0][7][9][0] = 122;
C[0][7][9][1] = 108;
C[0][7][9][2] = 87;
C[0][8][0][0] = 184;
C[0][8][0][1] = 185;
C[0][8][0][2] = 163;
C[0][8][1][0] = 191;
C[0][8][1][1] = 189;
C[0][8][1][2] = 174;
C[0][8][2][0] = 213;
C[0][8][2][1] = 184;
C[0][8][2][2] = 150;
C[0][8][3][0] = 204;
C[0][8][3][1] = 166;
C[0][8][3][2] = 141;
C[0][8][4][0] = 193;
C[0][8][4][1] = 177;
C[0][8][4][2] = 156;
C[0][8][5][0] = 191;
C[0][8][5][1] = 171;
C[0][8][5][2] = 150;
C[0][8][6][0] = 188;
C[0][8][6][1] = 171;
C[0][8][6][2] = 124;
C[0][8][7][0] = 187;
C[0][8][7][1] = 173;
C[0][8][7][2] = 123;
C[0][8][8][0] = 180;
C[0][8][8][1] = 162;
C[0][8][8][2] = 126;
C[0][8][9][0] = 116;
C[0][8][9][1] = 112;
C[0][8][9][2] = 99;
C[0][9][0][0] = 163;
C[0][9][0][1] = 167;
C[0][9][0][2] = 155;
C[0][9][1][0] = 177;
C[0][9][1][1] = 176;
C[0][9][1][2] = 163;
C[0][9][2][0] = 173;
C[0][9][2][1] = 160;
C[0][9][2][2] = 149;
C[0][9][3][0] = 183;
C[0][9][3][1] = 168;
C[0][9][3][2] = 156;
C[0][9][4][0] = 158;
C[0][9][4][1] = 147;
C[0][9][4][2] = 128;
C[0][9][5][0] = 176;
C[0][9][5][1] = 163;
C[0][9][5][2] = 145;
C[0][9][6][0] = 166;
C[0][9][6][1] = 153;
C[0][9][6][2] = 130;
C[0][9][7][0] = 161;
C[0][9][7][1] = 151;
C[0][9][7][2] = 127;
C[0][9][8][0] = 149;
C[0][9][8][1] = 135;
C[0][9][8][2] = 112;
C[0][9][9][0] = 113;
C[0][9][9][1] = 104;
C[0][9][9][2] = 80;
C[1][0][0][0] = 117;
C[1][0][0][1] = 113;
C[1][0][0][2] = 94;
C[1][0][1][0] = 121;
C[1][0][1][1] = 116;
C[1][0][1][2] = 96;
C[1][0][2][0] = 120;
C[1][0][2][1] = 115;
C[1][0][2][2] = 97;
C[1][0][3][0] = 131;
C[1][0][3][1] = 129;
C[1][0][3][2] = 112;
C[1][0][4][0] = 150;
C[1][0][4][1] = 147;
C[1][0][4][2] = 129;
C[1][0][5][0] = 156;
C[1][0][5][1] = 153;
C[1][0][5][2] = 135;
C[1][0][6][0] = 157;
C[1][0][6][1] = 152;
C[1][0][6][2] = 132;
C[1][0][7][0] = 159;
C[1][0][7][1] = 154;
C[1][0][7][2] = 135;
C[1][0][8][0] = 139;
C[1][0][8][1] = 130;
C[1][0][8][2] = 111;
C[1][0][9][0] = 129;
C[1][0][9][1] = 122;
C[1][0][9][2] = 103;
C[1][1][0][0] = 103;
C[1][1][0][1] = 100;
C[1][1][0][2] = 73;
C[1][1][1][0] = 101;
C[1][1][1][1] = 98;
C[1][1][1][2] = 69;
C[1][1][2][0] = 106;
C[1][1][2][1] = 102;
C[1][1][2][2] = 80;
C[1][1][3][0] = 114;
C[1][1][3][1] = 111;
C[1][1][3][2] = 82;
C[1][1][4][0] = 119;
C[1][1][4][1] = 118;
C[1][1][4][2] = 90;
C[1][1][5][0] = 132;
C[1][1][5][1] = 127;
C[1][1][5][2] = 97;
C[1][1][6][0] = 128;
C[1][1][6][1] = 121;
C[1][1][6][2] = 84;
C[1][1][7][0] = 118;
C[1][1][7][1] = 114;
C[1][1][7][2] = 83;
C[1][1][8][0] = 109;
C[1][1][8][1] = 102;
C[1][1][8][2] = 67;
C[1][1][9][0] = 108;
C[1][1][9][1] = 104;
C[1][1][9][2] = 78;
C[1][2][0][0] = 89;
C[1][2][0][1] = 84;
C[1][2][0][2] = 51;
C[1][2][1][0] = 89;
C[1][2][1][1] = 85;
C[1][2][1][2] = 52;
C[1][2][2][0] = 108;
C[1][2][2][1] = 100;
C[1][2][2][2] = 65;
C[1][2][3][0] = 114;
C[1][2][3][1] = 104;
C[1][2][3][2] = 68;
C[1][2][4][0] = 114;
C[1][2][4][1] = 111;
C[1][2][4][2] = 69;
C[1][2][5][0] = 127;
C[1][2][5][1] = 119;
C[1][2][5][2] = 77;
C[1][2][6][0] = 109;
C[1][2][6][1] = 104;
C[1][2][6][2] = 66;
C[1][2][7][0] = 106;
C[1][2][7][1] = 103;
C[1][2][7][2] = 66;
C[1][2][8][0] = 94;
C[1][2][8][1] = 89;
C[1][2][8][2] = 60;
C[1][2][9][0] = 90;
C[1][2][9][1] = 86;
C[1][2][9][2] = 60;
C[1][3][0][0] = 95;
C[1][3][0][1] = 90;
C[1][3][0][2] = 57;
C[1][3][1][0] = 94;
C[1][3][1][1] = 91;
C[1][3][1][2] = 57;
C[1][3][2][0] = 107;
C[1][3][2][1] = 98;
C[1][3][2][2] = 58;
C[1][3][3][0] = 103;
C[1][3][3][1] = 99;
C[1][3][3][2] = 58;
C[1][3][4][0] = 99;
C[1][3][4][1] = 95;
C[1][3][4][2] = 58;
C[1][3][5][0] = 104;
C[1][3][5][1] = 96;
C[1][3][5][2] = 59;
C[1][3][6][0] = 92;
C[1][3][6][1] = 89;
C[1][3][6][2] = 55;
C[1][3][7][0] = 79;
C[1][3][7][1] = 79;
C[1][3][7][2] = 50;
C[1][3][8][0] = 69;
C[1][3][8][1] = 63;
C[1][3][8][2] = 36;
C[1][3][9][0] = 71;
C[1][3][9][1] = 66;
C[1][3][9][2] = 40;
C[1][4][0][0] = 85;
C[1][4][0][1] = 81;
C[1][4][0][2] = 50;
C[1][4][1][0] = 97;
C[1][4][1][1] = 91;
C[1][4][1][2] = 55;
C[1][4][2][0] = 100;
C[1][4][2][1] = 97;
C[1][4][2][2] = 61;
C[1][4][3][0] = 95;
C[1][4][3][1] = 93;
C[1][4][3][2] = 60;
C[1][4][4][0] = 83;
C[1][4][4][1] = 85;
C[1][4][4][2] = 52;
C[1][4][5][0] = 89;
C[1][4][5][1] = 87;
C[1][4][5][2] = 48;
C[1][4][6][0] = 97;
C[1][4][6][1] = 94;
C[1][4][6][2] = 51;
C[1][4][7][0] = 87;
C[1][4][7][1] = 84;
C[1][4][7][2] = 50;
C[1][4][8][0] = 78;
C[1][4][8][1] = 73;
C[1][4][8][2] = 44;
C[1][4][9][0] = 87;
C[1][4][9][1] = 78;
C[1][4][9][2] = 49;
C[1][5][0][0] = 72;
C[1][5][0][1] = 72;
C[1][5][0][2] = 42;
C[1][5][1][0] = 78;
C[1][5][1][1] = 76;
C[1][5][1][2] = 40;
C[1][5][2][0] = 86;
C[1][5][2][1] = 84;
C[1][5][2][2] = 42;
C[1][5][3][0] = 88;
C[1][5][3][1] = 89;
C[1][5][3][2] = 49;
C[1][5][4][0] = 85;
C[1][5][4][1] = 85;
C[1][5][4][2] = 50;
C[1][5][5][0] = 85;
C[1][5][5][1] = 84;
C[1][5][5][2] = 48;
C[1][5][6][0] = 92;
C[1][5][6][1] = 90;
C[1][5][6][2] = 47;
C[1][5][7][0] = 76;
C[1][5][7][1] = 77;
C[1][5][7][2] = 43;
C[1][5][8][0] = 82;
C[1][5][8][1] = 77;
C[1][5][8][2] = 40;
C[1][5][9][0] = 82;
C[1][5][9][1] = 79;
C[1][5][9][2] = 48;
C[1][6][0][0] = 62;
C[1][6][0][1] = 59;
C[1][6][0][2] = 32;
C[1][6][1][0] = 82;
C[1][6][1][1] = 75;
C[1][6][1][2] = 37;
C[1][6][2][0] = 78;
C[1][6][2][1] = 75;
C[1][6][2][2] = 38;
C[1][6][3][0] = 88;
C[1][6][3][1] = 84;
C[1][6][3][2] = 40;
C[1][6][4][0] = 87;
C[1][6][4][1] = 81;
C[1][6][4][2] = 40;
C[1][6][5][0] = 82;
C[1][6][5][1] = 80;
C[1][6][5][2] = 39;
C[1][6][6][0] = 82;
C[1][6][6][1] = 83;
C[1][6][6][2] = 40;
C[1][6][7][0] = 85;
C[1][6][7][1] = 80;
C[1][6][7][2] = 40;
C[1][6][8][0] = 83;
C[1][6][8][1] = 73;
C[1][6][8][2] = 38;
C[1][6][9][0] = 73;
C[1][6][9][1] = 66;
C[1][6][9][2] = 38;
C[1][7][0][0] = 49;
C[1][7][0][1] = 44;
C[1][7][0][2] = 25;
C[1][7][1][0] = 59;
C[1][7][1][1] = 52;
C[1][7][1][2] = 28;
C[1][7][2][0] = 49;
C[1][7][2][1] = 48;
C[1][7][2][2] = 30;
C[1][7][3][0] = 55;
C[1][7][3][1] = 56;
C[1][7][3][2] = 33;
C[1][7][4][0] = 58;
C[1][7][4][1] = 56;
C[1][7][4][2] = 29;
C[1][7][5][0] = 62;
C[1][7][5][1] = 59;
C[1][7][5][2] = 29;
C[1][7][6][0] = 66;
C[1][7][6][1] = 67;
C[1][7][6][2] = 34;
C[1][7][7][0] = 63;
C[1][7][7][1] = 61;
C[1][7][7][2] = 31;
C[1][7][8][0] = 65;
C[1][7][8][1] = 59;
C[1][7][8][2] = 29;
C[1][7][9][0] = 60;
C[1][7][9][1] = 52;
C[1][7][9][2] = 31;
C[1][8][0][0] = 23;
C[1][8][0][1] = 22;
C[1][8][0][2] = 13;
C[1][8][1][0] = 28;
C[1][8][1][1] = 25;
C[1][8][1][2] = 13;
C[1][8][2][0] = 29;
C[1][8][2][1] = 27;
C[1][8][2][2] = 18;
C[1][8][3][0] = 30;
C[1][8][3][1] = 28;
C[1][8][3][2] = 17;
C[1][8][4][0] = 25;
C[1][8][4][1] = 26;
C[1][8][4][2] = 15;
C[1][8][5][0] = 23;
C[1][8][5][1] = 25;
C[1][8][5][2] = 14;
C[1][8][6][0] = 28;
C[1][8][6][1] = 28;
C[1][8][6][2] = 19;
C[1][8][7][0] = 26;
C[1][8][7][1] = 27;
C[1][8][7][2] = 18;
C[1][8][8][0] = 22;
C[1][8][8][1] = 19;
C[1][8][8][2] = 9;
C[1][8][9][0] = 25;
C[1][8][9][1] = 21;
C[1][8][9][2] = 10;
C[1][9][0][0] = 7;
C[1][9][0][1] = 9;
C[1][9][0][2] = 6;
C[1][9][1][0] = 11;
C[1][9][1][1] = 11;
C[1][9][1][2] = 8;
C[1][9][2][0] = 12;
C[1][9][2][1] = 11;
C[1][9][2][2] = 9;
C[1][9][3][0] = 14;
C[1][9][3][1] = 13;
C[1][9][3][2] = 10;
C[1][9][4][0] = 15;
C[1][9][4][1] = 14;
C[1][9][4][2] = 11;
C[1][9][5][0] = 14;
C[1][9][5][1] = 14;
C[1][9][5][2] = 11;
C[1][9][6][0] = 14;
C[1][9][6][1] = 15;
C[1][9][6][2] = 12;
C[1][9][7][0] = 12;
C[1][9][7][1] = 13;
C[1][9][7][2] = 10;
C[1][9][8][0] = 1;
C[1][9][8][1] = 1;
C[1][9][8][2] = 0;
C[1][9][9][0] = 1;
C[1][9][9][1] = 1;
C[1][9][9][2] = 0;
C[2][0][0][0] = 133;
C[2][0][0][1] = 124;
C[2][0][0][2] = 101;
C[2][0][1][0] = 137;
C[2][0][1][1] = 128;
C[2][0][1][2] = 106;
C[2][0][2][0] = 148;
C[2][0][2][1] = 134;
C[2][0][2][2] = 111;
C[2][0][3][0] = 137;
C[2][0][3][1] = 126;
C[2][0][3][2] = 102;
C[2][0][4][0] = 134;
C[2][0][4][1] = 126;
C[2][0][4][2] = 102;
C[2][0][5][0] = 123;
C[2][0][5][1] = 114;
C[2][0][5][2] = 92;
C[2][0][6][0] = 109;
C[2][0][6][1] = 98;
C[2][0][6][2] = 76;
C[2][0][7][0] = 90;
C[2][0][7][1] = 84;
C[2][0][7][2] = 65;
C[2][0][8][0] = 65;
C[2][0][8][1] = 60;
C[2][0][8][2] = 44;
C[2][0][9][0] = 61;
C[2][0][9][1] = 55;
C[2][0][9][2] = 42;
C[2][1][0][0] = 129;
C[2][1][0][1] = 119;
C[2][1][0][2] = 101;
C[2][1][1][0] = 137;
C[2][1][1][1] = 127;
C[2][1][1][2] = 107;
C[2][1][2][0] = 129;
C[2][1][2][1] = 120;
C[2][1][2][2] = 99;
C[2][1][3][0] = 134;
C[2][1][3][1] = 124;
C[2][1][3][2] = 103;
C[2][1][4][0] = 127;
C[2][1][4][1] = 119;
C[2][1][4][2] = 99;
C[2][1][5][0] = 112;
C[2][1][5][1] = 103;
C[2][1][5][2] = 86;
C[2][1][6][0] = 102;
C[2][1][6][1] = 87;
C[2][1][6][2] = 68;
C[2][1][7][0] = 88;
C[2][1][7][1] = 79;
C[2][1][7][2] = 62;
C[2][1][8][0] = 63;
C[2][1][8][1] = 58;
C[2][1][8][2] = 47;
C[2][1][9][0] = 57;
C[2][1][9][1] = 54;
C[2][1][9][2] = 43;
C[2][2][0][0] = 137;
C[2][2][0][1] = 129;
C[2][2][0][2] = 113;
C[2][2][1][0] = 137;
C[2][2][1][1] = 128;
C[2][2][1][2] = 109;
C[2][2][2][0] = 131;
C[2][2][2][1] = 123;
C[2][2][2][2] = 105;
C[2][2][3][0] = 126;
C[2][2][3][1] = 119;
C[2][2][3][2] = 102;
C[2][2][4][0] = 123;
C[2][2][4][1] = 116;
C[2][2][4][2] = 99;
C[2][2][5][0] = 104;
C[2][2][5][1] = 98;
C[2][2][5][2] = 78;
C[2][2][6][0] = 103;
C[2][2][6][1] = 93;
C[2][2][6][2] = 72;
C[2][2][7][0] = 83;
C[2][2][7][1] = 81;
C[2][2][7][2] = 66;
C[2][2][8][0] = 53;
C[2][2][8][1] = 51;
C[2][2][8][2] = 42;
C[2][2][9][0] = 54;
C[2][2][9][1] = 51;
C[2][2][9][2] = 42;
C[2][3][0][0] = 130;
C[2][3][0][1] = 122;
C[2][3][0][2] = 106;
C[2][3][1][0] = 131;
C[2][3][1][1] = 123;
C[2][3][1][2] = 108;
C[2][3][2][0] = 125;
C[2][3][2][1] = 116;
C[2][3][2][2] = 102;
C[2][3][3][0] = 119;
C[2][3][3][1] = 114;
C[2][3][3][2] = 100;
C[2][3][4][0] = 117;
C[2][3][4][1] = 112;
C[2][3][4][2] = 100;
C[2][3][5][0] = 103;
C[2][3][5][1] = 98;
C[2][3][5][2] = 85;
C[2][3][6][0] = 95;
C[2][3][6][1] = 91;
C[2][3][6][2] = 75;
C[2][3][7][0] = 70;
C[2][3][7][1] = 70;
C[2][3][7][2] = 59;
C[2][3][8][0] = 48;
C[2][3][8][1] = 44;
C[2][3][8][2] = 35;
C[2][3][9][0] = 46;
C[2][3][9][1] = 43;
C[2][3][9][2] = 37;
C[2][4][0][0] = 127;
C[2][4][0][1] = 119;
C[2][4][0][2] = 106;
C[2][4][1][0] = 125;
C[2][4][1][1] = 117;
C[2][4][1][2] = 102;
C[2][4][2][0] = 126;
C[2][4][2][1] = 116;
C[2][4][2][2] = 101;
C[2][4][3][0] = 131;
C[2][4][3][1] = 116;
C[2][4][3][2] = 95;
C[2][4][4][0] = 130;
C[2][4][4][1] = 119;
C[2][4][4][2] = 100;
C[2][4][5][0] = 104;
C[2][4][5][1] = 97;
C[2][4][5][2] = 85;
C[2][4][6][0] = 95;
C[2][4][6][1] = 85;
C[2][4][6][2] = 69;
C[2][4][7][0] = 70;
C[2][4][7][1] = 64;
C[2][4][7][2] = 49;
C[2][4][8][0] = 45;
C[2][4][8][1] = 41;
C[2][4][8][2] = 33;
C[2][4][9][0] = 40;
C[2][4][9][1] = 37;
C[2][4][9][2] = 32;
C[2][5][0][0] = 100;
C[2][5][0][1] = 92;
C[2][5][0][2] = 83;
C[2][5][1][0] = 107;
C[2][5][1][1] = 92;
C[2][5][1][2] = 76;
C[2][5][2][0] = 107;
C[2][5][2][1] = 95;
C[2][5][2][2] = 80;
C[2][5][3][0] = 110;
C[2][5][3][1] = 103;
C[2][5][3][2] = 92;
C[2][5][4][0] = 107;
C[2][5][4][1] = 96;
C[2][5][4][2] = 84;
C[2][5][5][0] = 86;
C[2][5][5][1] = 68;
C[2][5][5][2] = 52;
C[2][5][6][0] = 79;
C[2][5][6][1] = 63;
C[2][5][6][2] = 46;
C[2][5][7][0] = 52;
C[2][5][7][1] = 46;
C[2][5][7][2] = 32;
C[2][5][8][0] = 22;
C[2][5][8][1] = 20;
C[2][5][8][2] = 16;
C[2][5][9][0] = 16;
C[2][5][9][1] = 15;
C[2][5][9][2] = 13;
C[2][6][0][0] = 104;
C[2][6][0][1] = 91;
C[2][6][0][2] = 77;
C[2][6][1][0] = 108;
C[2][6][1][1] = 94;
C[2][6][1][2] = 79;
C[2][6][2][0] = 109;
C[2][6][2][1] = 101;
C[2][6][2][2] = 89;
C[2][6][3][0] = 109;
C[2][6][3][1] = 98;
C[2][6][3][2] = 86;
C[2][6][4][0] = 103;
C[2][6][4][1] = 90;
C[2][6][4][2] = 74;
C[2][6][5][0] = 84;
C[2][6][5][1] = 71;
C[2][6][5][2] = 55;
C[2][6][6][0] = 73;
C[2][6][6][1] = 65;
C[2][6][6][2] = 52;
C[2][6][7][0] = 46;
C[2][6][7][1] = 43;
C[2][6][7][2] = 35;
C[2][6][8][0] = 18;
C[2][6][8][1] = 16;
C[2][6][8][2] = 12;
C[2][6][9][0] = 16;
C[2][6][9][1] = 15;
C[2][6][9][2] = 13;
C[2][7][0][0] = 91;
C[2][7][0][1] = 83;
C[2][7][0][2] = 73;
C[2][7][1][0] = 88;
C[2][7][1][1] = 81;
C[2][7][1][2] = 73;
C[2][7][2][0] = 92;
C[2][7][2][1] = 80;
C[2][7][2][2] = 66;
C[2][7][3][0] = 89;
C[2][7][3][1] = 77;
C[2][7][3][2] = 65;
C[2][7][4][0] = 94;
C[2][7][4][1] = 87;
C[2][7][4][2] = 75;
C[2][7][5][0] = 56;
C[2][7][5][1] = 50;
C[2][7][5][2] = 41;
C[2][7][6][0] = 50;
C[2][7][6][1] = 43;
C[2][7][6][2] = 31;
C[2][7][7][0] = 34;
C[2][7][7][1] = 32;
C[2][7][7][2] = 25;
C[2][7][8][0] = 11;
C[2][7][8][1] = 9;
C[2][7][8][2] = 6;
C[2][7][9][0] = 6;
C[2][7][9][1] = 5;
C[2][7][9][2] = 4;
C[2][8][0][0] = 86;
C[2][8][0][1] = 80;
C[2][8][0][2] = 71;
C[2][8][1][0] = 84;
C[2][8][1][1] = 69;
C[2][8][1][2] = 57;
C[2][8][2][0] = 86;
C[2][8][2][1] = 75;
C[2][8][2][2] = 61;
C[2][8][3][0] = 81;
C[2][8][3][1] = 74;
C[2][8][3][2] = 64;
C[2][8][4][0] = 85;
C[2][8][4][1] = 77;
C[2][8][4][2] = 69;
C[2][8][5][0] = 48;
C[2][8][5][1] = 45;
C[2][8][5][2] = 39;
C[2][8][6][0] = 42;
C[2][8][6][1] = 39;
C[2][8][6][2] = 32;
C[2][8][7][0] = 32;
C[2][8][7][1] = 32;
C[2][8][7][2] = 26;
C[2][8][8][0] = 13;
C[2][8][8][1] = 13;
C[2][8][8][2] = 10;
C[2][8][9][0] = 0;
C[2][8][9][1] = 0;
C[2][8][9][2] = 0;
C[2][9][0][0] = 89;
C[2][9][0][1] = 75;
C[2][9][0][2] = 64;
C[2][9][1][0] = 91;
C[2][9][1][1] = 76;
C[2][9][1][2] = 60;
C[2][9][2][0] = 84;
C[2][9][2][1] = 78;
C[2][9][2][2] = 71;
C[2][9][3][0] = 87;
C[2][9][3][1] = 79;
C[2][9][3][2] = 72;
C[2][9][4][0] = 80;
C[2][9][4][1] = 72;
C[2][9][4][2] = 65;
C[2][9][5][0] = 55;
C[2][9][5][1] = 47;
C[2][9][5][2] = 40;
C[2][9][6][0] = 44;
C[2][9][6][1] = 38;
C[2][9][6][2] = 30;
C[2][9][7][0] = 33;
C[2][9][7][1] = 33;
C[2][9][7][2] = 25;
C[2][9][8][0] = 9;
C[2][9][8][1] = 10;
C[2][9][8][2] = 7;
C[2][9][9][0] = 0;
C[2][9][9][1] = 0;
C[2][9][9][2] = 0;
C[3][0][0][0] = 150;
C[3][0][0][1] = 86;
C[3][0][0][2] = 54;
C[3][0][1][0] = 146;
C[3][0][1][1] = 81;
C[3][0][1][2] = 50;
C[3][0][2][0] = 148;
C[3][0][2][1] = 84;
C[3][0][2][2] = 51;
C[3][0][3][0] = 149;
C[3][0][3][1] = 83;
C[3][0][3][2] = 50;
C[3][0][4][0] = 148;
C[3][0][4][1] = 83;
C[3][0][4][2] = 49;
C[3][0][5][0] = 117;
C[3][0][5][1] = 64;
C[3][0][5][2] = 45;
C[3][0][6][0] = 102;
C[3][0][6][1] = 58;
C[3][0][6][2] = 45;
C[3][0][7][0] = 69;
C[3][0][7][1] = 35;
C[3][0][7][2] = 23;
C[3][0][8][0] = 33;
C[3][0][8][1] = 7;
C[3][0][8][2] = 3;
C[3][0][9][0] = 26;
C[3][0][9][1] = 3;
C[3][0][9][2] = 4;
C[3][1][0][0] = 140;
C[3][1][0][1] = 82;
C[3][1][0][2] = 51;
C[3][1][1][0] = 129;
C[3][1][1][1] = 74;
C[3][1][1][2] = 55;
C[3][1][2][0] = 133;
C[3][1][2][1] = 77;
C[3][1][2][2] = 56;
C[3][1][3][0] = 137;
C[3][1][3][1] = 77;
C[3][1][3][2] = 55;
C[3][1][4][0] = 137;
C[3][1][4][1] = 78;
C[3][1][4][2] = 53;
C[3][1][5][0] = 112;
C[3][1][5][1] = 59;
C[3][1][5][2] = 43;
C[3][1][6][0] = 96;
C[3][1][6][1] = 53;
C[3][1][6][2] = 44;
C[3][1][7][0] = 75;
C[3][1][7][1] = 38;
C[3][1][7][2] = 23;
C[3][1][8][0] = 37;
C[3][1][8][1] = 8;
C[3][1][8][2] = 3;
C[3][1][9][0] = 29;
C[3][1][9][1] = 3;
C[3][1][9][2] = 4;
C[3][2][0][0] = 140;
C[3][2][0][1] = 89;
C[3][2][0][2] = 65;
C[3][2][1][0] = 135;
C[3][2][1][1] = 80;
C[3][2][1][2] = 64;
C[3][2][2][0] = 139;
C[3][2][2][1] = 83;
C[3][2][2][2] = 67;
C[3][2][3][0] = 143;
C[3][2][3][1] = 84;
C[3][2][3][2] = 67;
C[3][2][4][0] = 143;
C[3][2][4][1] = 85;
C[3][2][4][2] = 64;
C[3][2][5][0] = 115;
C[3][2][5][1] = 63;
C[3][2][5][2] = 51;
C[3][2][6][0] = 100;
C[3][2][6][1] = 55;
C[3][2][6][2] = 46;
C[3][2][7][0] = 79;
C[3][2][7][1] = 44;
C[3][2][7][2] = 35;
C[3][2][8][0] = 39;
C[3][2][8][1] = 9;
C[3][2][8][2] = 4;
C[3][2][9][0] = 30;
C[3][2][9][1] = 3;
C[3][2][9][2] = 4;
C[3][3][0][0] = 145;
C[3][3][0][1] = 92;
C[3][3][0][2] = 71;
C[3][3][1][0] = 140;
C[3][3][1][1] = 81;
C[3][3][1][2] = 64;
C[3][3][2][0] = 145;
C[3][3][2][1] = 84;
C[3][3][2][2] = 65;
C[3][3][3][0] = 148;
C[3][3][3][1] = 85;
C[3][3][3][2] = 64;
C[3][3][4][0] = 149;
C[3][3][4][1] = 86;
C[3][3][4][2] = 63;
C[3][3][5][0] = 116;
C[3][3][5][1] = 64;
C[3][3][5][2] = 53;
C[3][3][6][0] = 101;
C[3][3][6][1] = 59;
C[3][3][6][2] = 50;
C[3][3][7][0] = 79;
C[3][3][7][1] = 45;
C[3][3][7][2] = 37;
C[3][3][8][0] = 39;
C[3][3][8][1] = 9;
C[3][3][8][2] = 5;
C[3][3][9][0] = 30;
C[3][3][9][1] = 4;
C[3][3][9][2] = 4;
C[3][4][0][0] = 147;
C[3][4][0][1] = 103;
C[3][4][0][2] = 84;
C[3][4][1][0] = 140;
C[3][4][1][1] = 93;
C[3][4][1][2] = 75;
C[3][4][2][0] = 142;
C[3][4][2][1] = 95;
C[3][4][2][2] = 77;
C[3][4][3][0] = 143;
C[3][4][3][1] = 95;
C[3][4][3][2] = 74;
C[3][4][4][0] = 144;
C[3][4][4][1] = 96;
C[3][4][4][2] = 75;
C[3][4][5][0] = 110;
C[3][4][5][1] = 74;
C[3][4][5][2] = 66;
C[3][4][6][0] = 93;
C[3][4][6][1] = 67;
C[3][4][6][2] = 59;
C[3][4][7][0] = 70;
C[3][4][7][1] = 48;
C[3][4][7][2] = 41;
C[3][4][8][0] = 32;
C[3][4][8][1] = 10;
C[3][4][8][2] = 6;
C[3][4][9][0] = 24;
C[3][4][9][1] = 4;
C[3][4][9][2] = 5;
C[3][5][0][0] = 139;
C[3][5][0][1] = 108;
C[3][5][0][2] = 70;
C[3][5][1][0] = 138;
C[3][5][1][1] = 105;
C[3][5][1][2] = 66;
C[3][5][2][0] = 140;
C[3][5][2][1] = 106;
C[3][5][2][2] = 67;
C[3][5][3][0] = 142;
C[3][5][3][1] = 108;
C[3][5][3][2] = 67;
C[3][5][4][0] = 142;
C[3][5][4][1] = 109;
C[3][5][4][2] = 68;
C[3][5][5][0] = 110;
C[3][5][5][1] = 88;
C[3][5][5][2] = 59;
C[3][5][6][0] = 91;
C[3][5][6][1] = 76;
C[3][5][6][2] = 55;
C[3][5][7][0] = 52;
C[3][5][7][1] = 47;
C[3][5][7][2] = 40;
C[3][5][8][0] = 13;
C[3][5][8][1] = 9;
C[3][5][8][2] = 8;
C[3][5][9][0] = 6;
C[3][5][9][1] = 2;
C[3][5][9][2] = 1;
C[3][6][0][0] = 141;
C[3][6][0][1] = 88;
C[3][6][0][2] = 36;
C[3][6][1][0] = 140;
C[3][6][1][1] = 79;
C[3][6][1][2] = 30;
C[3][6][2][0] = 141;
C[3][6][2][1] = 81;
C[3][6][2][2] = 30;
C[3][6][3][0] = 143;
C[3][6][3][1] = 83;
C[3][6][3][2] = 30;
C[3][6][4][0] = 143;
C[3][6][4][1] = 87;
C[3][6][4][2] = 32;
C[3][6][5][0] = 111;
C[3][6][5][1] = 67;
C[3][6][5][2] = 23;
C[3][6][6][0] = 92;
C[3][6][6][1] = 54;
C[3][6][6][2] = 20;
C[3][6][7][0] = 45;
C[3][6][7][1] = 28;
C[3][6][7][2] = 15;
C[3][6][8][0] = 7;
C[3][6][8][1] = 4;
C[3][6][8][2] = 0;
C[3][6][9][0] = 0;
C[3][6][9][1] = 0;
C[3][6][9][2] = 0;
C[3][7][0][0] = 144;
C[3][7][0][1] = 86;
C[3][7][0][2] = 36;
C[3][7][1][0] = 144;
C[3][7][1][1] = 80;
C[3][7][1][2] = 29;
C[3][7][2][0] = 145;
C[3][7][2][1] = 80;
C[3][7][2][2] = 29;
C[3][7][3][0] = 146;
C[3][7][3][1] = 81;
C[3][7][3][2] = 29;
C[3][7][4][0] = 145;
C[3][7][4][1] = 84;
C[3][7][4][2] = 29;
C[3][7][5][0] = 113;
C[3][7][5][1] = 63;
C[3][7][5][2] = 19;
C[3][7][6][0] = 94;
C[3][7][6][1] = 50;
C[3][7][6][2] = 16;
C[3][7][7][0] = 44;
C[3][7][7][1] = 24;
C[3][7][7][2] = 13;
C[3][7][8][0] = 6;
C[3][7][8][1] = 4;
C[3][7][8][2] = 0;
C[3][7][9][0] = 0;
C[3][7][9][1] = 0;
C[3][7][9][2] = 0;
C[3][8][0][0] = 138;
C[3][8][0][1] = 83;
C[3][8][0][2] = 43;
C[3][8][1][0] = 140;
C[3][8][1][1] = 80;
C[3][8][1][2] = 34;
C[3][8][2][0] = 142;
C[3][8][2][1] = 83;
C[3][8][2][2] = 36;
C[3][8][3][0] = 143;
C[3][8][3][1] = 83;
C[3][8][3][2] = 34;
C[3][8][4][0] = 141;
C[3][8][4][1] = 81;
C[3][8][4][2] = 36;
C[3][8][5][0] = 110;
C[3][8][5][1] = 59;
C[3][8][5][2] = 20;
C[3][8][6][0] = 92;
C[3][8][6][1] = 46;
C[3][8][6][2] = 16;
C[3][8][7][0] = 42;
C[3][8][7][1] = 20;
C[3][8][7][2] = 12;
C[3][8][8][0] = 6;
C[3][8][8][1] = 3;
C[3][8][8][2] = 0;
C[3][8][9][0] = 0;
C[3][8][9][1] = 0;
C[3][8][9][2] = 0;
C[3][9][0][0] = 131;
C[3][9][0][1] = 84;
C[3][9][0][2] = 54;
C[3][9][1][0] = 132;
C[3][9][1][1] = 85;
C[3][9][1][2] = 50;
C[3][9][2][0] = 134;
C[3][9][2][1] = 86;
C[3][9][2][2] = 49;
C[3][9][3][0] = 135;
C[3][9][3][1] = 87;
C[3][9][3][2] = 50;
C[3][9][4][0] = 133;
C[3][9][4][1] = 86;
C[3][9][4][2] = 50;
C[3][9][5][0] = 105;
C[3][9][5][1] = 65;
C[3][9][5][2] = 33;
C[3][9][6][0] = 88;
C[3][9][6][1] = 50;
C[3][9][6][2] = 29;
C[3][9][7][0] = 40;
C[3][9][7][1] = 20;
C[3][9][7][2] = 12;
C[3][9][8][0] = 5;
C[3][9][8][1] = 3;
C[3][9][8][2] = 0;
C[3][9][9][0] = 0;
C[3][9][9][1] = 0;
C[3][9][9][2] = 0;
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
for (int k = 0; k < 3; k++) {
A[i][j][k] = 0;
}
}
}
for (int i = 0; i < N; i++) {
for (int j = 0; j < M; j++) {
A[i / 50][j / 50][0] += R[i][j];
A[i / 50][j / 50][1] += G[i][j];
A[i / 50][j / 50][2] += B[i][j];
}
}
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
for (int k = 0; k < 3; k++) {
A[i][j][k] /= 2500;
}
}
}
pair<int, int> res = make_pair(1e9, -1);
for (int X = 0; X < 4; X++) {
int sum = 0.0L;
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
int dist = 0;
for (int k = 0; k < 3; k++) {
dist += (C[X][i][j][k] - A[i][j][k]) * (C[X][i][j][k] - A[i][j][k]);
}
sum += dist;
}
}
res = min(res, make_pair(sum, X + 1));
}
return res.second;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |