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