# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1276176 | Aviansh | Question (Grader is different from the original contest) (CEOI14_question_grader) | C++20 | 1031 ms | 39732 KiB |
#include <bits/stdc++.h>
using namespace std;
int encode (int n, int x, int y) {
vector<int>pos = {0,4032,4000,3936,3808,3552,3040,2016,3984,3920,3792,3536,3024,2000,3888,3760,3504,2992,1968,3696,3440,2928,1904,3312,2800,1776,2544,1520,1008,3976,3912,3784,3528,3016,1992,3880,3752,3496,2984,1960,3688,3432,2920,1896,3304,2792,1768,2536,1512,1000,3864,3736,3480,2968,1944,3672,3416,2904,1880,3288,2776,1752,2520,1496,984,3640,3384,2872,1848,3256,2744,1720,2488,1464,952,3192,2680,1656,2424,1400,888,2296,1272,760,504,3972,3908,3780,3524,3012,1988,3876,3748,3492,2980,1956,3684,3428,2916,1892,3300,2788,1764,2532,1508,996,3860,3732,3476,2964,1940,3668,3412,2900,1876,3284,2772,1748,2516,1492,980,3636,3380,2868,1844,3252,2740,1716,2484,1460,948,3188,2676,1652,2420,1396,884,2292,1268,756,500,3852,3724,3468,2956,1932,3660,3404,2892,1868,3276,2764,1740,2508,1484,972,3628,3372,2860,1836,3244,2732,1708,2476,1452,940,3180,2668,1644,2412,1388,876,2284,1260,748,492,3612,3356,2844,1820,3228,2716,1692,2460,1436,924,3164,2652,1628,2396,1372,860,2268,1244,732,476,3132,2620,1596,2364,1340,828,2236,1212,700,444,2172,1148,636,380,252,3970,3906,3778,3522,3010,1986,3874,3746,3490,2978,1954,3682,3426,2914,1890,3298,2786,1762,2530,1506,994,3858,3730,3474,2962,1938,3666,3410,2898,1874,3282,2770,1746,2514,1490,978,3634,3378,2866,1842,3250,2738,1714,2482,1458,946,3186,2674,1650,2418,1394,882,2290,1266,754,498,3850,3722,3466,2954,1930,3658,3402,2890,1866,3274,2762,1738,2506,1482,970,3626,3370,2858,1834,3242,2730,1706,2474,1450,938,3178,2666,1642,2410,1386,874,2282,1258,746,490,3610,3354,2842,1818,3226,2714,1690,2458,1434,922,3162,2650,1626,2394,1370,858,2266,1242,730,474,3130,2618,1594,2362,1338,826,2234,1210,698,442,2170,1146,634,378,250,3846,3718,3462,2950,1926,3654,3398,2886,1862,3270,2758,1734,2502,1478,966,3622,3366,2854,1830,3238,2726,1702,2470,1446,934,3174,2662,1638,2406,1382,870,2278,1254,742,486,3606,3350,2838,1814,3222,2710,1686,2454,1430,918,3158,2646,1622,2390,1366,854,2262,1238,726,470,3126,2614,1590,2358,1334,822,2230,1206,694,438,2166,1142,630,374,246,3598,3342,2830,1806,3214,2702,1678,2446,1422,910,3150,2638,1614,2382,1358,846,2254,1230,718,462,3118,2606,1582,2350,1326,814,2222,1198,686,430,2158,1134,622,366,238,3102,2590,1566,2334,1310,798,2206,1182,670,414,2142,1118,606,350,222,2110,1086,574,318,190,126,3969,3905,3777,3521,3009,1985,3873,3745,3489,2977,1953,3681,3425,2913,1889,3297,2785,1761,2529,1505,993,3857,3729,3473,2961,1937,3665,3409,2897,1873,3281,2769,1745,2513,1489,977,3633,3377,2865,1841,3249,2737,1713,2481,1457,945,3185,2673,1649,2417,1393,881,2289,1265,753,497,3849,3721,3465,2953,1929,3657,3401,2889,1865,3273,2761,1737,2505,1481,969,3625,3369,2857,1833,3241,2729,1705,2473,1449,937,3177,2665,1641,2409,1385,873,2281,1257,745,489,3609,3353,2841,1817,3225,2713,1689,2457,1433,921,3161,2649,1625,2393,1369,857,2265,1241,729,473,3129,2617,1593,2361,1337,825,2233,1209,697,441,2169,1145,633,377,249,3845,3717,3461,2949,1925,3653,3397,2885,1861,3269,2757,1733,2501,1477,965,3621,3365,2853,1829,3237,2725,1701,2469,1445,933,3173,2661,1637,2405,1381,869,2277,1253,741,485,3605,3349,2837,1813,3221,2709,1685,2453,1429,917,3157,2645,1621,2389,1365,853,2261,1237,725,469,3125,2613,1589,2357,1333,821,2229,1205,693,437,2165,1141,629,373,245,3597,3341,2829,1805,3213,2701,1677,2445,1421,909,3149,2637,1613,2381,1357,845,2253,1229,717,461,3117,2605,1581,2349,1325,813,2221,1197,685,429,2157,1133,621,365,237,3101,2589,1565,2333,1309,797,2205,1181,669,413,2141,1117,605,349,221,2109,1085,573,317,189,125,3843,3715,3459,2947,1923,3651,3395,2883,1859,3267,2755,1731,2499,1475,963,3619,3363,2851,1827,3235,2723,1699,2467,1443,931,3171,2659,1635,2403,1379,867,2275,1251,739,483,3603,3347,2835,1811,3219,2707,1683,2451,1427,915,3155,2643,1619,2387,1363,851,2259,1235,723,467,3123,2611,1587,2355,1331,819,2227,1203,691,435,2163,1139,627,371,243,3595,3339,2827,1803,3211,2699,1675,2443,1419,907,3147,2635,1611,2379,1355,843,2251,1227,715,459,3115,2603,1579,2347,1323,811,2219,1195,683,427,2155,1131,619,363,235,3099,2587,1563,2331,1307,795,2203,1179,667,411,2139,1115,603,347,219,2107,1083,571,315,187,123,3591,3335,2823,1799,3207,2695,1671,2439,1415,903,3143,2631,1607,2375,1351,839,2247,1223,711,455,3111,2599,1575,2343,1319,807,2215,1191,679,423,2151,1127,615,359,231,3095,2583,1559,2327,1303,791,2199,1175,663,407,2135,1111,599,343,215,2103,1079,567,311,183,119,3087,2575,1551,2319,1295,783,2191,1167,655,399,2127,1103,591,335,207,2095,1071,559,303,175,111,2079,1055,543};
int p = pos[x]^pos[y];
for(int i = 0;i<12;i++){
if(p&(1<<i)){
if(pos[x]&(1<<i))
return i+1;
}
}
assert(0);
}
#include <bits/stdc++.h>
using namespace std;
int decode (int n, int q, int h) {
h--;
vector<int>pos = {0,4032,4000,3936,3808,3552,3040,2016,3984,3920,3792,3536,3024,2000,3888,3760,3504,2992,1968,3696,3440,2928,1904,3312,2800,1776,2544,1520,1008,3976,3912,3784,3528,3016,1992,3880,3752,3496,2984,1960,3688,3432,2920,1896,3304,2792,1768,2536,1512,1000,3864,3736,3480,2968,1944,3672,3416,2904,1880,3288,2776,1752,2520,1496,984,3640,3384,2872,1848,3256,2744,1720,2488,1464,952,3192,2680,1656,2424,1400,888,2296,1272,760,504,3972,3908,3780,3524,3012,1988,3876,3748,3492,2980,1956,3684,3428,2916,1892,3300,2788,1764,2532,1508,996,3860,3732,3476,2964,1940,3668,3412,2900,1876,3284,2772,1748,2516,1492,980,3636,3380,2868,1844,3252,2740,1716,2484,1460,948,3188,2676,1652,2420,1396,884,2292,1268,756,500,3852,3724,3468,2956,1932,3660,3404,2892,1868,3276,2764,1740,2508,1484,972,3628,3372,2860,1836,3244,2732,1708,2476,1452,940,3180,2668,1644,2412,1388,876,2284,1260,748,492,3612,3356,2844,1820,3228,2716,1692,2460,1436,924,3164,2652,1628,2396,1372,860,2268,1244,732,476,3132,2620,1596,2364,1340,828,2236,1212,700,444,2172,1148,636,380,252,3970,3906,3778,3522,3010,1986,3874,3746,3490,2978,1954,3682,3426,2914,1890,3298,2786,1762,2530,1506,994,3858,3730,3474,2962,1938,3666,3410,2898,1874,3282,2770,1746,2514,1490,978,3634,3378,2866,1842,3250,2738,1714,2482,1458,946,3186,2674,1650,2418,1394,882,2290,1266,754,498,3850,3722,3466,2954,1930,3658,3402,2890,1866,3274,2762,1738,2506,1482,970,3626,3370,2858,1834,3242,2730,1706,2474,1450,938,3178,2666,1642,2410,1386,874,2282,1258,746,490,3610,3354,2842,1818,3226,2714,1690,2458,1434,922,3162,2650,1626,2394,1370,858,2266,1242,730,474,3130,2618,1594,2362,1338,826,2234,1210,698,442,2170,1146,634,378,250,3846,3718,3462,2950,1926,3654,3398,2886,1862,3270,2758,1734,2502,1478,966,3622,3366,2854,1830,3238,2726,1702,2470,1446,934,3174,2662,1638,2406,1382,870,2278,1254,742,486,3606,3350,2838,1814,3222,2710,1686,2454,1430,918,3158,2646,1622,2390,1366,854,2262,1238,726,470,3126,2614,1590,2358,1334,822,2230,1206,694,438,2166,1142,630,374,246,3598,3342,2830,1806,3214,2702,1678,2446,1422,910,3150,2638,1614,2382,1358,846,2254,1230,718,462,3118,2606,1582,2350,1326,814,2222,1198,686,430,2158,1134,622,366,238,3102,2590,1566,2334,1310,798,2206,1182,670,414,2142,1118,606,350,222,2110,1086,574,318,190,126,3969,3905,3777,3521,3009,1985,3873,3745,3489,2977,1953,3681,3425,2913,1889,3297,2785,1761,2529,1505,993,3857,3729,3473,2961,1937,3665,3409,2897,1873,3281,2769,1745,2513,1489,977,3633,3377,2865,1841,3249,2737,1713,2481,1457,945,3185,2673,1649,2417,1393,881,2289,1265,753,497,3849,3721,3465,2953,1929,3657,3401,2889,1865,3273,2761,1737,2505,1481,969,3625,3369,2857,1833,3241,2729,1705,2473,1449,937,3177,2665,1641,2409,1385,873,2281,1257,745,489,3609,3353,2841,1817,3225,2713,1689,2457,1433,921,3161,2649,1625,2393,1369,857,2265,1241,729,473,3129,2617,1593,2361,1337,825,2233,1209,697,441,2169,1145,633,377,249,3845,3717,3461,2949,1925,3653,3397,2885,1861,3269,2757,1733,2501,1477,965,3621,3365,2853,1829,3237,2725,1701,2469,1445,933,3173,2661,1637,2405,1381,869,2277,1253,741,485,3605,3349,2837,1813,3221,2709,1685,2453,1429,917,3157,2645,1621,2389,1365,853,2261,1237,725,469,3125,2613,1589,2357,1333,821,2229,1205,693,437,2165,1141,629,373,245,3597,3341,2829,1805,3213,2701,1677,2445,1421,909,3149,2637,1613,2381,1357,845,2253,1229,717,461,3117,2605,1581,2349,1325,813,2221,1197,685,429,2157,1133,621,365,237,3101,2589,1565,2333,1309,797,2205,1181,669,413,2141,1117,605,349,221,2109,1085,573,317,189,125,3843,3715,3459,2947,1923,3651,3395,2883,1859,3267,2755,1731,2499,1475,963,3619,3363,2851,1827,3235,2723,1699,2467,1443,931,3171,2659,1635,2403,1379,867,2275,1251,739,483,3603,3347,2835,1811,3219,2707,1683,2451,1427,915,3155,2643,1619,2387,1363,851,2259,1235,723,467,3123,2611,1587,2355,1331,819,2227,1203,691,435,2163,1139,627,371,243,3595,3339,2827,1803,3211,2699,1675,2443,1419,907,3147,2635,1611,2379,1355,843,2251,1227,715,459,3115,2603,1579,2347,1323,811,2219,1195,683,427,2155,1131,619,363,235,3099,2587,1563,2331,1307,795,2203,1179,667,411,2139,1115,603,347,219,2107,1083,571,315,187,123,3591,3335,2823,1799,3207,2695,1671,2439,1415,903,3143,2631,1607,2375,1351,839,2247,1223,711,455,3111,2599,1575,2343,1319,807,2215,1191,679,423,2151,1127,615,359,231,3095,2583,1559,2327,1303,791,2199,1175,663,407,2135,1111,599,343,215,2103,1079,567,311,183,119,3087,2575,1551,2319,1295,783,2191,1167,655,399,2127,1103,591,335,207,2095,1071,559,303,175,111,2079,1055,543};
if(pos[q]&(1<<h)){
return 1;
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |