Submission #110558

# Submission time Handle Problem Language Result Execution time Memory
110558 2019-05-11T07:12:06 Z ckodser Question (Grader is different from the original contest) (CEOI14_question_grader) C++14
100 / 100
1529 ms 78712 KB
#include<bits/stdc++.h>
#include <functional>

#define ll int
#define pb push_back
#define mp make_pair
#define ld long double
#define F first
#define S second
#define pii pair<ll,ll> 

using namespace :: std;

const ll mod=1e9+7;
const ll maxn=1000;
const ll inf=1e9+900;

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

int encode(int n, int x, int y) {
    for(ll i=0;i<12;i++){
	if(((f[x]>>i)&1)==0 && ((f[y]>>i)&1)==1){
	    return i+1;
	}
    }
}
#include<bits/stdc++.h>
#include <functional>

#define ll int
#define pb push_back
#define mp make_pair
#define ld long double
#define F first
#define S second
#define pii pair<ll,ll> 

using namespace :: std;

const ll mod=1e9+7;
const ll maxn=1000;
const ll inf=1e9+900;

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

Compilation message

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:26:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Correct 1529 ms 78712 KB Output is correct - maxh = 12
2 Correct 1527 ms 78704 KB Output is correct - maxh = 12