# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1063537 |
2024-08-17T20:04:17 Z |
alexdd |
Magic Show (APIO24_show) |
C++17 |
|
4 ms |
820 KB |
#include <bits/stdc++.h>
#include "Alice.h"
using namespace std;
int nrma[5005] = {-1,892,2628,2332,235,1162,1119,3194,2973,472,3761,1249,3591,4566,2996,2647,1035,3322,3698,2530,1876,2293,4041,1668,433,3163,2460,674,1588,4383,1188,4298,4711,524,768,656,3794,3887,3683,2612,3503,2059,929,1111,275,986,1252,3454,4732,3792,2007,3494,2767,3197,3186,857,2537,2413,3748,304,4311,3095,27,2060,122,804,528,1397,3146,1570,952,4479,560,406,574,4776,3554,3691,2528,1479,1192,2365,2929,370,820,2103,3218,2639,2701,2797,507,4175,1158,1646,4279,4331,3594,3789,4140,1376,4907,3170,2744,2414,4871,3602,4287,3726,1458,2559,4628,3129,2188,570,4318,4579,329,4495,3277,1122,4946,2889,2644,1307,2921,1186,3374,1556,2246,918,124,133,3959,1160,2152,796,4751,199,4686,1573,3694,1127,529,4872,2878,2057,3661,292,3084,4550,3997,3837,4457,3413,3009,3637,1699,3345,2262,633,2062,1895,4393,1564,1945,1298,469,1665,3489,4671,4930,1396,205,3420,2520,2587,1415,1315,4783,1084,4273,2074,1437,3349,4127,3987,4112,4054,2446,4921,3214,4307,3569,1455,325,3814,2750,3514,1626,2233,4915,3567,3119,505,3756,4572,2679,2714,4363,4546,4584,943,944,13,43,3260,1830,4439,3411,4317,4223,2985,1687,3952,3314,3601,2110,4576,3284,3011,2613,808,5,2856,1416,2016,4199,3360,2545,1624,4624,3354,2505,1816,780,814,3876,3242,1161,4350,4590,1025,3944,3283,2307,3379,1562,4083,3366,494,4272,266,2641,3791,3365,198,3671,4194,2713,89,1322,3458,2107,2278,4052,686,4229,3516,4220,1137,2387,2598,1777,3183,2977,4415,1139,611,3451,1738,3024,2573,4097,1313,1648,18,3030,671,2832,2681,3097,1908,4985,1854,4130,412,4468,3597,4257,2925,2627,3780,3190,2730,1542,939,4565,2155,283,2522,1760,1242,1146,1441,4640,4894,4407,3164,600,4840,3198,3087,4113,2150,4721,1170,1741,3128,2602,4417,2670,2668,783,1837,911,3319,747,1448,3945,4162,2339,2971,894,49,3596,320,252,3897,4411,3426,2019,1228,1360,1262,3525,1261,356,3456,4660,3708,856,2778,4826,4224,389,1923,749,3208,1737,4977,1637,367,2192,3521,1545,3787,4221,976,2593,4612,4676,680,3860,1806,1779,4877,4941,3480,255,1163,4347,2907,3340,4901,14,3110,2324,567,2056,1685,2704,4007,1379,3579,4136,493,2261,3401,3292,4367,974,913,4545,969,2782,4070,1988,376,3055,1852,2234,130,4246,1243,1672,1282,4773,4486,988,4561,2085,538,3937,1885,885,2459,4854,449,2047,2913,1593,4410,1912,1976,2924,3176,2622,2141,2541,3631,3500,1383,733,3066,3080,3225,206,4369,1423,4013,3722,3206,4800,1531,1683,270,1778,4507,4421,3583,3191,3946,3010,4494,4816,264,2532,4870,2425,3005,3425,1255,4954,2454,1232,3298,4862,3852,4784,2046,2095,1505,3094,3706,3296,278,2260,2024,1101,3765,462,675,2244,1424,52,1536,1452,1431,2161,113,2810,2813,504,4427,2994,3841,3759,4731,4354,1075,3068,322,3071,4388,1250,4428,4195,2434,2415,4342,2310,1849,2561,709,912,2781,548,3824,1019,3988,1054,663,1244,2842,4563,375,1260,2674,456,163,3729,3965,3855,3061,515,4595,1326,3626,1729,3398,2816,4654,4837,3747,4938,1940,635,2610,2121,4460,644,4873,3777,659,1734,4233,1121,1512,1029,1786,109,2591,4341,3432,3077,2315,2891,3609,3469,1560,3209,1086,4648,3684,251,3007,64,1561,3058,1140,1904,1208,2229,3613,869,815,1663,2411,1906,3714,3078,3912,2909,1543,4425,799,1123,1795,3556,1865,2094,3992,2168,1642,3285,119,1147,1911,1408,2416,2455,1841,514,762,3266,3215,602,4733,2256,4399,1332,263,2272,2400,2892,517,3682,708,3223,1366,4076,2507,3490,3016,2621,4306,2041,4353,1656,4933,4750,4203,700,3803,2220,3137,4864,2031,161,1897,194,1181,411,1754,1124,987,4883,3948,79,4568,2757,1115,321,1135,3536,2065,2575,2266,3380,466,1371,3484,4359,963,924,3290,243,1318,3465,4236,3920,22,1815,1977,4983,3472,1065,1466,2918,3271,3702,955,4386,787,4564,3652,3901,3428,3680,966,2499,2634,2373,1050,995,397,4947,840,3573,4976,1682,645,619,2066,2828,3834,900,4553,4472,827,149,901,3435,2364,4145,317,1974,2371,3310,2296,1919,221,798,3118,1571,3167,950,2553,1405,1631,4859,1614,2910,2835,795,2752,4961,4555,382,4214,2176,218,2329,3760,779,4817,4048,386,3368,2883,4045,1130,4222,1098,1445,233,3351,4420,2253,4003,1410,2404,1457,3017,4264,4803,769,3888,4090,268,1453,2899,3565,403,4244,77,298,1751,78,1293,69,3753,217,1082,4164,4863,2482,2524,4312,2651,3348,2739,4093,2702,4556,1821,4465,4957,380,1818,2708,4322,4161,351,2053,2356,1744,4173,4701,4005,2020,3383,347,4471,555,1032,3145,2619,3344,2316,2525,835,1344,3275,3304,2191,3634,3315,1957,45,2420,2133,3196,2275,1669,3444,4663,2043,2709,1936,4688,3424,2376,491,3871,3389,661,3922,1569,4313,3307,4881,4015,3477,4447,643,2625,2940,3418,1076,3230,1692,294,4496,563,589,1639,2989,4923,2360,365,2333,2443,1465,4240,1805,2401,3387,3978,3914,238,1047,1710,463,4362,1568,1191,2694,1643,1385,2282,4147,4970,2981,4738,4180,2215,180,1887,1748,4204,2531,3772,3475,2523,2632,2930,137,3970,4874,2589,4865,1615,4772,2247,785,4024,1196,4451,1429,4868,2384,1516,2017,3790,39,726,1200,2317,4814,4767,4255,1454,1991,557,394,3004,2431,1046,2539,3938,2309,3008,4253,3551,1157,3881,3981,1595,3740,357,4739,849,1868,3806,880,3448,3595,1636,765,4809,741,3033,174,3287,3775,1992,4528,576,4051,1271,4669,369,2130,1288,1141,200,1835,3676,4665,2839,1264,4371,3000,1381,2359,4836,4511,3115,3943,3731,3550,4593,3036,1650,1752,3375,2054,3742,2636,4993,1784,170,1323,2671,1320,2760,3089,2955,669,4397,182,446,948,111,4461,2898,879,4637,2374,2895,927,3131,3385,1811,4608,3705,3581,2003,4165,3372,458,1033,3763,3253,4252,537,2964,1878,1425,3527,691,1787,30,3629,257,2138,2865,2144,3961,4463,1725,3741,1482,961,746,585,4880,2462,506,3124,3773,2700,4436,4193,4955,4151,3113,3902,703,361,4086,2361,4186,2516,1382,1526,344,231,4235,3244,3442,6,1797,598,410,2980,3718,2369,1150,3281,4025,2838,2720,2785,3369,2655,2616,25,3449,3606,1565,2549,3873,3833,3333,1494,926,4,4932,3331,40,2699,919,3735,4026,4023,17,3356,1378,2406,917,3306,4166,185,797,1339,1764,2205,2134,4230,1890,4716,1489,1407,4662,4063,4336,1559,2870,3324,810,2479,2225,4011,4538,1503,4170,470,1931,97,3474,1297,4487,4680,4454,1882,3156,592,1418,1049,4304,2998,1984,4664,2328,4960,714,608,3032,1091,4105,440,3086,56,2936,3745,2258,3716,2645,2590,3963,3491,772,2976,448,4503,2245,1551,425,1961,874,1866,3272,371,3355,3842,2657,627,2653,1747,1059,2180,3502,2897,314,3257,3764,3258,813,3848,4316,372,3338,1387,2119,2335,559,3762,2447,984,116,72,2819,688,4184,50,1017,4128,3172,527,1864,4066,1506,249,336,603,4917,4643,4291,3719,4159,1834,2858,3769,996,3677,2097,3134,2472,2751,4695,3441,922,4743,1583,4948,2871,228,4794,68,434,120,3002,3544,2748,3294,47,689,1057,2993,3532,484,4607,2457,1369,145,1071,2582,1924,3054,3153,2646,1504,777,3312,2491,3687,1472,4493,1582,2494,2851,831,4575,3335,3467,3900,177,4337,4962,1063,10,354,3576,4509,2146,842,4570,1718,3165,374,4087,744,2682,2888,2418,409,1763,2124,201,1723,4122,2312,1486,1966,4799,2440,1528,2204,4679,4500,341,3767,1159,1044,490,169,271,2734,3757,4185,167,390,1918,1590,569,3144,2412,761,4841,1860,1274,1422,728,4470,4389,4014,277,1180,332,626,1515,2032,4687,980,223,414,4727,2381,1802,4702,2806,2500,2435,1519,4183,2125,276,2286,2620,346,1439,1219,2203,4728,497,4693,1524,468,3523,1666,819,1079,2187,1267,2922,4987,2403,4260,3234,1401,4714,3116,1116,620,4335,697,3410,2267,1790,112,2776,3723,1031,960,4057,3091,4152,102,1606,3013,1211,1202,1770,3831,889,2596,1438,495,3317,2672,4328,2257,4581,4061,1857,2803,550,2966,1463,273,3102,1234,392,1278,3617,2643,477,1862,593,3213,4822,3734,3427,3869,1430,240,695,1872,4587,1370,16,3547,720,3910,991,1804,3046,2726,1781,3621,1535,2547,2493,3126,3286,4994,2558,4835,3991,2269,1843,3843,2129,2829,2555,4618,3035,1838,4104,457,2349,405,1973,4217,4382,1989,4094,638,832,183,4887,4053,4178,1007,2770,4384,1757,2800,3819,2592,4749,4557,2696,4741,2392,2697,2823,1056,605,2230,2987,4996,496,3262,3774,4736,316,2740,556,1599,3280,2495,186,4745,4156,2139,3415,2424,3143,1540,1296,398,4209,4056,1110,2279,3027,312,1218,1316,3060,465,731,4228,152,2642,417,2900,3211,782,3107,1470,3566,860,4412,1879,2291,4656,4124,1016,2302,3048,877,4319,899,2535,1368,4174,1000,3749,3899,2937,4617,2945,1456,3329,3778,1367,4429,4508,4299,4548,1833,1740,1688,66,4071,3112,2321,2637,3509,1199,3725,3603,1265,4219,4215,789,2738,1073,755,3739,896,3325,253,3,2214,816,2885,287,1901,2174,3614,632,4942,4443,135,4582,2026,4848,2581,1223,932,2931,595,328,670,1240,2611,2458,279,2088,1142,1447,2070,4167,60,4577,3202,3654,500,3562,4320,910,338,1294,311,2805,1125,4982,3018,4408,542,2928,237,3908,4988,4605,2761,3618,2394,3224,1088,4625,4433,1106,730,1550,4192,2449,1055,1026,4506,1858,1686,2407,3720,662,3222,2213,904,1794,4351,4642,4422,844,4370,1942,3592,3101,4956,4100,1735,4788,2961,150,2093,2902,4327,3730,771,1004,305,1283,3616,2,2685,1193,106,125,1023,3462,3407,2432,4601,1722,1364,1610,2101,2807,2469,4966,3847,3628,4102,3138,3043,4846,1990,1272,1362,8,1182,649,3201,4286,687,4900,1684,1497,1799,587,4402,778,3840,1289,3650,4758,1972,3915,994,2175,461,1087,99,4804,2436,227,3904,4780,1263,1153,3520,3429,4567,3481,1484,3568,4207,4744,2352,38,1676,2773,786,1801,1450,2515,140,1097,1459,711,4467,616,3478,2774,566,1753,1658,2064,190,1732,4296,3264,1522,1386,81,2318,1331,2232,1696,4012,1350,4101,1377,2238,2409,1342,1166,3851,1036,1856,4592,3998,82,4245,3958,802,2086,4616,3934,290,306,2239,993,4789,2508,4740,890,3999,1963,1935,4091,4348,3434,628,3738,4456,3057,4558,2399,295,1254,330,204,1690,590,735,2163,1832,3973,2920,1257,1745,3041,1645,1201,1268,2564,36,379,3299,698,4653,232,594,4843,4000,763,2115,1011,3960,3564,997,1814,2227,2441,1629,395,2798,3289,2542,2111,830,2594,2090,4064,334,4154,2956,3388,2716,4705,4069,1190,1213,1782,2300,4860,4922,4028,863,4986,3630,1245,1579,3751,3160,4400,4237,3510,3177,144,3624,3412,2357,871,4752,4706,784,2673,2039,3534,1285,3042,2841,2199,1743,3416,4394,4629,2565,2903,2618,4435,3877,324,121,2337,4251,3455,4638,33,1877,4218,3955,2005,1776,1167,1979,509,2640,1525,216,422,4010,3546,503,4305,4594,610,178,1041,2741,4774,2736,358,1154,1720,552,564,3600,508,1356,3642,1400,3358,1487,26,368,2854,1509,93,2812,817,4831,1808,3856,2292,404,4234,3828,15,215,2543,3651,4302,2478,4201,1677,4525,3233,3795,1807,4160,2490,893,1501,4116,1175,3653,719,3711,1929,3754,2853,855,4114,2540,2132,1045,1346,4712,3696,3966,4958,2814,4020,258,1078,4906,2216,139,2689,3394,4720,1184,4067,98,2343,3868,870,1480,2270,2105,2603,822,3417,4903,2848,3750,4289,1803,4801,1938,2000,1946,4107,1899,757,2983,3846,3857,288,897,3316,3861,2228,2098,1464,3025,1080,2340,2982,4855,4074,4792,1742,1413,2079,760,4911,1727,4779,847,3996,4477,1557,4782,4920,1607,1527,1474,866,1276,2501,3117,176,1324,4377,4935,4441,3026,181,1749,34,2886,4810,4338,861,3062,1312,3219,1521,2908,4807,4724,388,3712,1329,3486,2010,1231,2142,903,2276,2788,3096,4882,2669,2916,3895,4169,1171,4303,723,3636,4661,246,2288,3064,664,3713,3408,907,1874,265,1109,2759,2905,35,4036,4668,1099,1500,3053,724,407,4857,3620,683,793,4259,4647,408,3572,1269,436,123,3588,973,4484,4785,839,729,4952,3974,2438,673,3371,4838,3664,2970,2688,3508,931,487,2170,4126,1700,1916,19,3809,2172,3893,1434,3301,4413,4885,1214,2008,4811,4764,2904,302,67,2933,623,3453,3141,4366,4375,146,692,3752,229,1883,3318,3063,2915,2585,4866,4673,2834,2468,4580,1798,3732,1399,812,1951,2100,4269,1227,736,1406,858,4258,1733,4489,2887,3495,4089,4526,2997,4325,4821,3611,3645,127,4355,878,3688,1964,2330,554,1711,1870,1855,3985,3399,2960,4226,41,694,4700,4480,4212,3395,3917,2294,3784,3770,4742,4769,2567,2395,4604,3517,2189,586,12,3666,1694,881,3276,1353,4442,4459,1172,1253,2990,758,2480,4285,4849,4519,4635,4387,781,3171,2569,4944,867,534,4802,975,4666,2355,2680,1621,3200,4527,2218,4198,1847,3542,4374,1411,2075,2768,565,1939,672,3300,2148,978,734,3647,665,1310,4293,2833,2082,2890,2962,1060,575,2919,1726,2390,1628,2758,2338,2607,923,1092,2223,2368,2957,3733,2562,3122,2102,159,838,1846,3293,2578,4886,2901,1390,2051,353,2846,1792,4650,1594,2638,4200,3100,2844,2383,1761,2872,2826,4340,1468,3185,309,1074,327,2626,3669,20,451,513,3343,2224,4949,3139,3069,4696,3957,4171,4096,4858,2917,168,617,3492,4267,3800,1471,3700,806,3243,3675,1558,4551,2729,2601,4432,1507,2577,171,2533,4768,740,4916,3352,1578,2687,2034,3015,315,2165,1937,4092,596,2855,212,4614,281,2018,1327,4844,3259,2991,773,1173,1478,3056,2113,4308,4971,4380,3497,32,4403,4098,3515,4914,224,679,1996,4543,558,1460,3796,4984,2941,4062,4878,1094,982,3031,4475,464,4043,1343,1259,4037,293,646,2068,2861,3173,1451,4343,2836,2241,1089,4759,4488,957,179,4775,442,3226,4031,2860,1100,4959,2791,1863,1103,184,4909,3850,3524,3889,1187,4297,1824,580,2167,4478,4990,3640,2727,716,3400,3805,1533,956,1871,4963,3528,4055,2677,4148,475,843,3039,166,1085,1467,2649,512,4434,1239,1958,4981,916,3282,3291,1144,790,1314,4282,2445,1009,1627,852,4401,3308,1317,132,2656,4344,1905,2193,4968,3392,1433,3279,1853,4586,2378,2511,452,3530,3989,3405,908,4373,4786,104,2821,108,3783,1051,3703,928,1762,2664,3220,3496,1622,977,2880,531,4452,1695,2052,1947,143,2173,331,262,631,2815,3328,2927,3452,1898,3158,2648,1336,2122,2544,400,4262,1117,2818,444,2690,568,3670,142,4761,2968,888,2808,4241,1604,90,2787,91,1229,1421,4633,2325,4735,4897,3604,381,4018,4123,4513,340,3648,2733,1183,2426,1875,203,86,4210,3038,3951,4469,4006,4225,3882,3867,3633,3485,3130,2140,2551,1664,4073,4534,478,4777,2754,2430,3586,4099,936,985,4449,4182,1952,2106,2663,4825,1126,3950,1215,4238,4464,438,3302,4723,4523,3162,1675,1149,1068,3995,2809,1649,1207,3928,3571,4002,706,4850,853,1355,4205,1347,2999,562,654,1771,153,1546,4940,2840,1820,1496,2242,1640,2867,4603,998,2072,2799,4265,4485,4753,803,3381,3513,2693,3954,1698,1705,196,4754,2650,2476,3923,349,4972,895,1783,3639,1758,621,3678,4544,2576,1442,1335,2375,3758,3862,2944,4588,1810,3577,3545,4315,3193,2137,2372,1151,1349,2950,1842,764,399,2235,4795,486,2080,4620,1572,3321,3125,4757,4179,2120,1580,313,3470,1105,970,1724,4288,1612,2935,3926,1066,2866,53,707,310,4206,3073,3440,1746,4597,2755,430,702,637,3378,851,3323,2588,339,535,510,4280,3367,3082,250,4131,2162,1577,1971,2263,2953,1391,4426,3267,3662,3250,3020,4631,3384,693,2271,2083,2894,2843,3570,1632,3674,776,1739,3045,360,173,544,1651,1093,4294,2346,1959,378,1667,1013,4211,1927,2705,1197,4250,753,4391,3817,1886,2958,4378,3059,3254,11,823,3635,3099,1769,2366,476,1205,4585,3701,1796,3404,4125,2914,1428,4191,541,2837,54,226,4044,2869,650,2212,3240,4034,1005,2200,676,1354,3919,1697,4937,431,2281,3885,4017,164,1028,2341,3549,1426,1925,1825,4639,2743,2488,2570,1008,1359,1475,3169,2073,2336,460,1538,3483,1567,1325,4571,540,225,3479,4176,4497,1775,3511,4634,1956,2126,300,3006,3526,3256,2386,2652,4995,2852,151,3507,1299,865,4913,1203,597,2145,1014,4879,2136,4823,3362,4290,3357,1138,2509,1210,2795,4261,4554,2001,1168,2724,3582,2510,62,3252,2236,2011,2483,4395,4851,209,547,4755,1768,1281,4358,2405,4110,2151,3120,4361,1950,4522,3845,946,2877,2984,3065,343,4082,2595,4032,1630,100,2949,51,1679,2492,1914,2868,571,2560,4719,4578,4309,3744,2783,1345,971,4646,4008,1960,4345,236,1962,3199,1357,1844,3239,738,4419,107,2283,3548,818,2348,3463,3373,4177,147,4275,2194,2264,3811,4143,70,549,1155,4372,3152,4498,1020,155,2087,3956,3155,80,1305,479,807,3627,792,2777,3391,3673,3672,103,2061,4978,2311,2571,188,244,2684,2884,1714,441,3859,3798,1773,759,3487,3874,4476,2965,3423,701,794,4703,3363,1995,1030,2461,4197,630,1709,2746,2742,1072,128,722,3132,3518,189,423,3464,1913,1216,345,2881,1987,3359,604,2402,1928,2623,2456,213,4852,2514,805,2240,4150,2164,3649,2197,4065,876,4499,2304,2749,4027,1566,1589,3826,165,471,1226,55,3665,551,75,4678,3829,4771,3361,3406,2042,110,4725,2896,3217,1532,1477,3248,323,4659,3903,2179,2849,1034,1850,3863,4797,767,230,3501,3506,2308,4763,4276,4939,854,1716,1300,4974,4134,553,2780,1701,1302,118,1069,4121,4692,24,3519,4694,4615,2737,3685,2974,175,2350,214,4621,3443,2437,710,4927,3437,4414,2055,841,3658,1591,1839,3370,1955,2772,4135,3940,1611,3825,875,2875,2756,2939,260,2143,2089,2536,2342,2382,2464,3228,4945,1473,1435,202,1689,3643,4748,248,1238,1483,2237,4833,1334,850,1845,2969,572,1446,3971,3445,3667,4818,1062,377,655,2661,788,4770,4630,4314,4058,2206,3872,4824,4969,1462,2289,2428,1319,2033,156,2021,3830,2938,4505,2099,2287,1772,4899,3498,4967,1220,1206,373,2423,4196,1592,2683,727,2995,1058,4677,4529,1867,2069,1290,4168,2118,3918,4950,2157,718,2036,2077,3704,2952,2186,2475,905,1932,2273,4142,2882,2370,1731,427,2303,4009,2769,4424,2028,4081,868,2811,115,3916,2471,2498,1176,4301,1765,4718,1352,1633,1730,1152,625,1644,3590,1427,1986,4332,1618,1603,4667,615,3203,2695,1333,887,3977,363,2633,4243,3268,245,2290,2327,1018,4912,4766,4158,4078,3663,4756,636,3779,474,37,3533,157,836,3212,3906,3419,4819,2326,3104,3450,3168,4521,1134,1920,3421,4856,3844,4115,473,2182,234,712,3612,2986,482,3305,1548,748,1530,967,3531,2465,4888,2972,933,1922,211,4208,4806,2473,4691,2948,4657,2299,3393,3972,3270,1511,2710,4324,935,2863,4537,2703,648,4884,2830,4717,2169,3067,134,3593,3249,1982,1549,1488,2827,4381,737,3786,883,681,4613,4385,873,2268,2050,1209,3346,2599,2659,1513,3766,3488,4360,2534,1823,1657,2497,480,308,2556,2084,4713,1719,4030,272,3537,1012,424,1129,599,4274,3695,3994,3681,383,3802,2519,2912,3019,1419,1440,195,1481,2058,4406,3339,421,1902,2377,1412,3589,872,1660,4842,3771,359,2442,126,1114,1495,4867,4392,3121,1678,4674,2583,1671,1204,3466,934,4928,1128,533,4931,4829,4524,4333,2552,4239,1492,2662,3181,2721,3755,1891,3076,2067,1330,3930,83,2448,925,4918,1707,3350,677,775,3607,3396,2211,1680,1417,4908,1224,1896,1585,3246,1230,2452,2666,501,618,3468,704,2906,1490,3332,1893,2009,2295,4929,766,4722,2177,1337,4672,4798,326,1693,3610,1222,415,2675,4132,1759,3493,1840,666,1605,2484,4095,829,519,2398,1728,2277,3529,2421,3072,1003,3127,2753,3188,2255,4137,3808,1024,2222,3879,3656,4602,525,2831,4118,715,4060,2254,3047,4891,141,4339,1351,2408,3587,591,3023,2862,3237,3563,2923,3255,3098,3727,2071,3499,930,2967,1983,2259,4277,1225,4141,4444,1338,959,1576,4109,1113,1414,845,2538,2635,4689,4352,1736,4839,502,4734,2048,2692,4623,2128,4149,2487,3969,3679,1491,2306,4492,4300,3641,3241,1198,696,2947,384,172,4729,3743,1291,4975,1586,3699,583,2678,2251,1617,1273,2353,2658,3238,1469,3402,2185,3326,1070,3982,2745,2417,4284,3709,4896,2794,774,3522,318,3430,920,1436,402,954,1237,4636,3967,821,2934,545,4992,4146,4698,1616,2793,751,3646,2712,393,3797,3021,46,1933,3884,4510,44,3438,4905,4611,96,4445,4606,2217,3154,682,660,1095,4876,3439,3111,3539,445,2109,3820,296,641,2044,241,4919,2166,1303,2354,3578,3157,1634,419,523,92,3724,1547,3505,4813,3034,483,114,3605,3029,42,1953,4440,2579,1061,2158,197,811,1767,4943,3715,882,4458,4991,1389,88,3932,1819,222,3106,1156,4418,3090,2665,3911,1791,1404,526,1461,3247,4016,2397,4655,3175,3227,2723,4035,4892,1892,884,1673,1552,921,958,4356,4562,4600,4832,937,1393,71,4247,2305,63,3364,2209,1625,906,1270,4644,158,2691,2975,1022,1363,2159,579,3782,742,1756,546,1021,581,2731,2210,2314,4310,3231,1502,4088,3907,3001,2747,350,1598,4172,578,1177,333,4077,299,1247,4042,3561,1941,4820,3799,992,2792,3512,609,2617,3446,4188,2081,160,3686,756,2181,4815,4129,800,3898,4430,7,1812,4390,429,1948,1652,1328,1809,4119,2108,3993,1301,3014,4531,2992,1921,1052,1256,2859,3768,1308,2718,3878,1195,2604,385,4951,1619,1655,3788,3891,2226,2049,3585,1712,3968,3892,1970,3660,2988,1090,4040,3457,4431,1277,4875,3447,2574,3555,2038,1884,2004,2320,3560,3431,4787,1185,2040,4446,4423,4396,1212,3853,4980,1241,4632,1620,1394,3178,3947,4398,3793,4573,4730,1635,3263,2630,717,362,3050,2521,2615,1789,754,1038,1165,2334,2728,2512,3619,2504,4641,3135,117,1541,745,4516,2297,3935,2959,713,4541,1596,1251,3717,1169,1717,891,3979,824,530,2453,3382,3347,3886,809,3051,2466,4323,3079,1713,3697,4518,4103,2932,2766,612,3147,3040,59,4019,1258,3288,573,3245,968,1800,481,4416,289,4583,2358,2248,4376,4610,1750,1365,3180,3123,2127,3986,4547,4791,634,4021,2951,2506,4187,642,2393,1286,914,3632,1,3148,4847,4138,286,1077,4530,1112,2114,4232,3864,450,4033,136,2025,3273,2112,1064,3353,254,1295,3933,4001,532,162,3261,426,4709,3179,2029,3092,3810,3929,3832,3274,3232,962,2006,3311,2771,2513,3151,825,4050,4853,3182,303,1869,4022,3105,3184,1999,3313,2116,4953,4068,459,2876,4658,4278,1194,2323,539,2963,1609,2850,2606,3559,2485,3939,561,2732,1997,2503,1662,640,3535,1608,2027,690,4683,1132,668,1881,2252,4106,21,1498,516,1829,3558,4157,1449,3221,3964,4321,1975,432,1388,488,3827,23,1574,4964,4710,3807,416,1174,964,2250,4589,2243,657,4283,951,261,3309,447,2153,1010,1659,3403,29,3342,2779,1848,4619,3931,1039,2979,2527,1443,1822,1246,4591,57,4902,4596,1392,653,4242,953,1145,2331,4520,2719,4268,3838,1083,4778,862,2030,2171,76,4762,4080,2347,297,4049,828,1373,3471,31,1930,4483,259,148,2477,2893,2775,1375,2624,284,280,3114,3085,1702,1827,3103,4675,2202,2789,4781,105,437,837,4979,613,3924,4552,1836,3599,9,1136,2954,274,3150,2231,4326,439,1280,4682,48,938,1279,543,3574,2285,2201,2762,1178,3975,3949,1766,2784,269,1287,1402,2023,647,4139,1304,3849,4368,1859,2078,207,3265,1600,601,2946,1143,2298,4271,1539,4715,2496,4450,2183,2396,4925,4155,3541,2096,4292,1221,1653,3980,536,4448,2439,3207,3608,3865,3883,3622,2698,3327,4281,3823,3159,3433,1981,3142,3109,2481,1236,3836,2363,1674,2367,4153,2557,335,3044,2711,3337,2274,2584,972,1555,2864,1358,3689,2801,1432,453,3822,2147,337,3334,3336,4796,4828,4533,3818,1980,4409,4491,2786,2824,826,4539,2022,74,941,291,1985,1969,801,1292,267,2526,2654,3921,2804,4861,4652,4989,2722,3746,391,2422,4760,2351,4163,3615,4910,2280,3081,1553,4973,942,85,4834,94,1518,1529,1372,4263,3140,4039,3813,1654,2149,3721,4765,685,3909,4609,2380,3028,2385,1248,2825,4072,511,965,3913,4079,3776,4626,4349,1321,4404,606,3003,2190,4437,3204,307,219,1903,2629,2873,95,864,4502,1340,1978,1002,3644,4334,3149,3812,2600,2735,2014,4726,979,1584,3459,990,364,4029,2517,242,1217,4869,3962,2207,1164,2433,1233,301,4512,2660,492,187,3707,1900,2706,2463,588,28,1774,3189,73,396,4598,1788,4697,2667,750,2076,498,285,1517,4681,2502,3866,2847,4075,3854,1817,1534,833,4997,2518,467,61,4144,678,4569,4542,4248,3236,4574,2221,2580,2597,3251,3804,4926,4473,191,443,4747,3905,4812,2345,4515,3657,4536,577,699,2874,4599,940,2012,1493,4934,4346,3052,2015,658,915,2450,3543,4405,2013,3890,1793,352,1993,2926,4133,4924,435,2195,2717,3088,3580,2796,4540,193,3093,2563,3216,2763,1348,1623,3875,499,2429,2529,4227,210,1374,1873,1309,4685,3414,1133,1828,3598,3692,582,2391,4216,3690,2845,3269,208,2219,1510,4466,1826,2608,2605,4651,4707,2319,3894,2820,3461,1889,1523,2160,3540,2123,624,101,1968,4936,2198,3482,1949,2322,2474,2817,1284,1118,256,3476,2002,3012,2470,3390,4202,3195,1638,2631,1037,1641,3278,4790,1926,4004,192,2467,2764,752,4560,1120,138,1755,3668,3880,4462,1409,4453,418,1102,2379,2568,4890,2419,1715,1514,721,614,4504,2857,732,3210,945,3187,3781,3638,639,3303,1880,239,2572,1311,387,2035,1006,1361,3295,2790,1189,3409,3174,667,1398,1380,1915,902,3022,4699,3835,4670,3584,4231,4535,2249,2362,791,1670,1040,4645,4517,2265,3728,4737,1934,4085,4690,1131,1602,4622,3936,348,1597,4898,1909,4649,2045,1831,1647,909,848,4047,2725,3205,3839,1104,1266,2131,1967,949,1721,2486,2822,834,3386,3976,4266,1780,4329,3083,846,4117,4181,4108,3136,4120,3736,1235,485,1537,1476,3896,4965,3821,1703,2313,3436,4793,1575,2489,2879,2104,4893,4438,3552,1910,2063,1998,4059,3553,3070,3575,401,342,4254,4889,3376,3925,4482,3161,1954,2715,3320,4746,1706,989,1888,1704,4514,1681,2554,886,84,1785,3953,58,3557,3192,4704,1341,3623,1043,1894,1395,2156,1587,739,4684,2135,4084,521,652,2154,1096,3990,3816,4845,651,2301,1691,319,770,859,3297,4365,1081,2943,4364,413,1306,2444,420,282,489,2978,4379,1027,3942,4189,2091,3858,1179,705,4532,2178,2911,4559,3984,522,355,4708,4213,154,4357,247,2566,129,1907,1601,3460,4046,1053,2686,1943,2765,622,1485,220,2196,3625,3504,2427,684,2614,1508,1708,3785,3108,3422,4490,3815,2546,3801,4827,2388,1148,4111,2389,1015,1520,3927,4190,3538,428,1042,1613,3330,4330,4474,983,454,3229,1108,947,4501,584,1403,3870,3049,2184,2092,1275,87,1384,1067,2451,2284,981,3166,2548,1048,3037,629,725,3397,1554,1499,3983,898,4481,2942,4038,4270,2802,3737,520,3235,518,1107,3074,4808,3133,65,1661,3659,1851,1544,1917,4805,2676,2586,3693,2344,4904,2707,4627,131,607,999,1994,2410,1444,4256,1001,3075,3655,4455,2550,2117,1944,4830,1861,4295,2037,3710,4249,2609,1420,3941,743,4895,1581,2208,3341,4549,3377,1965,455,3473,1563,1813,366};
std::vector<std::pair<int,int>> Alice()
{
int N = 5000;
long long k = setN(N);
vector<pair<int,int>> edges;
edges.push_back({N,N-1});
edges.push_back({N,N-2});
for(int i=1;i<=N-3;i++)
{
int b = i%60;
if(((1LL<<b)&k))
{
edges.push_back({N-1,nrma[i]});
}
else
{
edges.push_back({N-2,nrma[i]});
}
}
return edges;
}
/**
N
/ \
N-1 N-2
/ \
A B
A = biti 1
B = biti 0
*/
#include <bits/stdc++.h>
#include "Bob.h"
// you may define some global variables, but it does not work if you try to transfer any information from function Alice() to function Bob() through these variables.
// you had better not use the same global variables in function Alice() and in function Bob().
using namespace std;
int nrmb[5005] = {-1,892,2628,2332,235,1162,1119,3194,2973,472,3761,1249,3591,4566,2996,2647,1035,3322,3698,2530,1876,2293,4041,1668,433,3163,2460,674,1588,4383,1188,4298,4711,524,768,656,3794,3887,3683,2612,3503,2059,929,1111,275,986,1252,3454,4732,3792,2007,3494,2767,3197,3186,857,2537,2413,3748,304,4311,3095,27,2060,122,804,528,1397,3146,1570,952,4479,560,406,574,4776,3554,3691,2528,1479,1192,2365,2929,370,820,2103,3218,2639,2701,2797,507,4175,1158,1646,4279,4331,3594,3789,4140,1376,4907,3170,2744,2414,4871,3602,4287,3726,1458,2559,4628,3129,2188,570,4318,4579,329,4495,3277,1122,4946,2889,2644,1307,2921,1186,3374,1556,2246,918,124,133,3959,1160,2152,796,4751,199,4686,1573,3694,1127,529,4872,2878,2057,3661,292,3084,4550,3997,3837,4457,3413,3009,3637,1699,3345,2262,633,2062,1895,4393,1564,1945,1298,469,1665,3489,4671,4930,1396,205,3420,2520,2587,1415,1315,4783,1084,4273,2074,1437,3349,4127,3987,4112,4054,2446,4921,3214,4307,3569,1455,325,3814,2750,3514,1626,2233,4915,3567,3119,505,3756,4572,2679,2714,4363,4546,4584,943,944,13,43,3260,1830,4439,3411,4317,4223,2985,1687,3952,3314,3601,2110,4576,3284,3011,2613,808,5,2856,1416,2016,4199,3360,2545,1624,4624,3354,2505,1816,780,814,3876,3242,1161,4350,4590,1025,3944,3283,2307,3379,1562,4083,3366,494,4272,266,2641,3791,3365,198,3671,4194,2713,89,1322,3458,2107,2278,4052,686,4229,3516,4220,1137,2387,2598,1777,3183,2977,4415,1139,611,3451,1738,3024,2573,4097,1313,1648,18,3030,671,2832,2681,3097,1908,4985,1854,4130,412,4468,3597,4257,2925,2627,3780,3190,2730,1542,939,4565,2155,283,2522,1760,1242,1146,1441,4640,4894,4407,3164,600,4840,3198,3087,4113,2150,4721,1170,1741,3128,2602,4417,2670,2668,783,1837,911,3319,747,1448,3945,4162,2339,2971,894,49,3596,320,252,3897,4411,3426,2019,1228,1360,1262,3525,1261,356,3456,4660,3708,856,2778,4826,4224,389,1923,749,3208,1737,4977,1637,367,2192,3521,1545,3787,4221,976,2593,4612,4676,680,3860,1806,1779,4877,4941,3480,255,1163,4347,2907,3340,4901,14,3110,2324,567,2056,1685,2704,4007,1379,3579,4136,493,2261,3401,3292,4367,974,913,4545,969,2782,4070,1988,376,3055,1852,2234,130,4246,1243,1672,1282,4773,4486,988,4561,2085,538,3937,1885,885,2459,4854,449,2047,2913,1593,4410,1912,1976,2924,3176,2622,2141,2541,3631,3500,1383,733,3066,3080,3225,206,4369,1423,4013,3722,3206,4800,1531,1683,270,1778,4507,4421,3583,3191,3946,3010,4494,4816,264,2532,4870,2425,3005,3425,1255,4954,2454,1232,3298,4862,3852,4784,2046,2095,1505,3094,3706,3296,278,2260,2024,1101,3765,462,675,2244,1424,52,1536,1452,1431,2161,113,2810,2813,504,4427,2994,3841,3759,4731,4354,1075,3068,322,3071,4388,1250,4428,4195,2434,2415,4342,2310,1849,2561,709,912,2781,548,3824,1019,3988,1054,663,1244,2842,4563,375,1260,2674,456,163,3729,3965,3855,3061,515,4595,1326,3626,1729,3398,2816,4654,4837,3747,4938,1940,635,2610,2121,4460,644,4873,3777,659,1734,4233,1121,1512,1029,1786,109,2591,4341,3432,3077,2315,2891,3609,3469,1560,3209,1086,4648,3684,251,3007,64,1561,3058,1140,1904,1208,2229,3613,869,815,1663,2411,1906,3714,3078,3912,2909,1543,4425,799,1123,1795,3556,1865,2094,3992,2168,1642,3285,119,1147,1911,1408,2416,2455,1841,514,762,3266,3215,602,4733,2256,4399,1332,263,2272,2400,2892,517,3682,708,3223,1366,4076,2507,3490,3016,2621,4306,2041,4353,1656,4933,4750,4203,700,3803,2220,3137,4864,2031,161,1897,194,1181,411,1754,1124,987,4883,3948,79,4568,2757,1115,321,1135,3536,2065,2575,2266,3380,466,1371,3484,4359,963,924,3290,243,1318,3465,4236,3920,22,1815,1977,4983,3472,1065,1466,2918,3271,3702,955,4386,787,4564,3652,3901,3428,3680,966,2499,2634,2373,1050,995,397,4947,840,3573,4976,1682,645,619,2066,2828,3834,900,4553,4472,827,149,901,3435,2364,4145,317,1974,2371,3310,2296,1919,221,798,3118,1571,3167,950,2553,1405,1631,4859,1614,2910,2835,795,2752,4961,4555,382,4214,2176,218,2329,3760,779,4817,4048,386,3368,2883,4045,1130,4222,1098,1445,233,3351,4420,2253,4003,1410,2404,1457,3017,4264,4803,769,3888,4090,268,1453,2899,3565,403,4244,77,298,1751,78,1293,69,3753,217,1082,4164,4863,2482,2524,4312,2651,3348,2739,4093,2702,4556,1821,4465,4957,380,1818,2708,4322,4161,351,2053,2356,1744,4173,4701,4005,2020,3383,347,4471,555,1032,3145,2619,3344,2316,2525,835,1344,3275,3304,2191,3634,3315,1957,45,2420,2133,3196,2275,1669,3444,4663,2043,2709,1936,4688,3424,2376,491,3871,3389,661,3922,1569,4313,3307,4881,4015,3477,4447,643,2625,2940,3418,1076,3230,1692,294,4496,563,589,1639,2989,4923,2360,365,2333,2443,1465,4240,1805,2401,3387,3978,3914,238,1047,1710,463,4362,1568,1191,2694,1643,1385,2282,4147,4970,2981,4738,4180,2215,180,1887,1748,4204,2531,3772,3475,2523,2632,2930,137,3970,4874,2589,4865,1615,4772,2247,785,4024,1196,4451,1429,4868,2384,1516,2017,3790,39,726,1200,2317,4814,4767,4255,1454,1991,557,394,3004,2431,1046,2539,3938,2309,3008,4253,3551,1157,3881,3981,1595,3740,357,4739,849,1868,3806,880,3448,3595,1636,765,4809,741,3033,174,3287,3775,1992,4528,576,4051,1271,4669,369,2130,1288,1141,200,1835,3676,4665,2839,1264,4371,3000,1381,2359,4836,4511,3115,3943,3731,3550,4593,3036,1650,1752,3375,2054,3742,2636,4993,1784,170,1323,2671,1320,2760,3089,2955,669,4397,182,446,948,111,4461,2898,879,4637,2374,2895,927,3131,3385,1811,4608,3705,3581,2003,4165,3372,458,1033,3763,3253,4252,537,2964,1878,1425,3527,691,1787,30,3629,257,2138,2865,2144,3961,4463,1725,3741,1482,961,746,585,4880,2462,506,3124,3773,2700,4436,4193,4955,4151,3113,3902,703,361,4086,2361,4186,2516,1382,1526,344,231,4235,3244,3442,6,1797,598,410,2980,3718,2369,1150,3281,4025,2838,2720,2785,3369,2655,2616,25,3449,3606,1565,2549,3873,3833,3333,1494,926,4,4932,3331,40,2699,919,3735,4026,4023,17,3356,1378,2406,917,3306,4166,185,797,1339,1764,2205,2134,4230,1890,4716,1489,1407,4662,4063,4336,1559,2870,3324,810,2479,2225,4011,4538,1503,4170,470,1931,97,3474,1297,4487,4680,4454,1882,3156,592,1418,1049,4304,2998,1984,4664,2328,4960,714,608,3032,1091,4105,440,3086,56,2936,3745,2258,3716,2645,2590,3963,3491,772,2976,448,4503,2245,1551,425,1961,874,1866,3272,371,3355,3842,2657,627,2653,1747,1059,2180,3502,2897,314,3257,3764,3258,813,3848,4316,372,3338,1387,2119,2335,559,3762,2447,984,116,72,2819,688,4184,50,1017,4128,3172,527,1864,4066,1506,249,336,603,4917,4643,4291,3719,4159,1834,2858,3769,996,3677,2097,3134,2472,2751,4695,3441,922,4743,1583,4948,2871,228,4794,68,434,120,3002,3544,2748,3294,47,689,1057,2993,3532,484,4607,2457,1369,145,1071,2582,1924,3054,3153,2646,1504,777,3312,2491,3687,1472,4493,1582,2494,2851,831,4575,3335,3467,3900,177,4337,4962,1063,10,354,3576,4509,2146,842,4570,1718,3165,374,4087,744,2682,2888,2418,409,1763,2124,201,1723,4122,2312,1486,1966,4799,2440,1528,2204,4679,4500,341,3767,1159,1044,490,169,271,2734,3757,4185,167,390,1918,1590,569,3144,2412,761,4841,1860,1274,1422,728,4470,4389,4014,277,1180,332,626,1515,2032,4687,980,223,414,4727,2381,1802,4702,2806,2500,2435,1519,4183,2125,276,2286,2620,346,1439,1219,2203,4728,497,4693,1524,468,3523,1666,819,1079,2187,1267,2922,4987,2403,4260,3234,1401,4714,3116,1116,620,4335,697,3410,2267,1790,112,2776,3723,1031,960,4057,3091,4152,102,1606,3013,1211,1202,1770,3831,889,2596,1438,495,3317,2672,4328,2257,4581,4061,1857,2803,550,2966,1463,273,3102,1234,392,1278,3617,2643,477,1862,593,3213,4822,3734,3427,3869,1430,240,695,1872,4587,1370,16,3547,720,3910,991,1804,3046,2726,1781,3621,1535,2547,2493,3126,3286,4994,2558,4835,3991,2269,1843,3843,2129,2829,2555,4618,3035,1838,4104,457,2349,405,1973,4217,4382,1989,4094,638,832,183,4887,4053,4178,1007,2770,4384,1757,2800,3819,2592,4749,4557,2696,4741,2392,2697,2823,1056,605,2230,2987,4996,496,3262,3774,4736,316,2740,556,1599,3280,2495,186,4745,4156,2139,3415,2424,3143,1540,1296,398,4209,4056,1110,2279,3027,312,1218,1316,3060,465,731,4228,152,2642,417,2900,3211,782,3107,1470,3566,860,4412,1879,2291,4656,4124,1016,2302,3048,877,4319,899,2535,1368,4174,1000,3749,3899,2937,4617,2945,1456,3329,3778,1367,4429,4508,4299,4548,1833,1740,1688,66,4071,3112,2321,2637,3509,1199,3725,3603,1265,4219,4215,789,2738,1073,755,3739,896,3325,253,3,2214,816,2885,287,1901,2174,3614,632,4942,4443,135,4582,2026,4848,2581,1223,932,2931,595,328,670,1240,2611,2458,279,2088,1142,1447,2070,4167,60,4577,3202,3654,500,3562,4320,910,338,1294,311,2805,1125,4982,3018,4408,542,2928,237,3908,4988,4605,2761,3618,2394,3224,1088,4625,4433,1106,730,1550,4192,2449,1055,1026,4506,1858,1686,2407,3720,662,3222,2213,904,1794,4351,4642,4422,844,4370,1942,3592,3101,4956,4100,1735,4788,2961,150,2093,2902,4327,3730,771,1004,305,1283,3616,2,2685,1193,106,125,1023,3462,3407,2432,4601,1722,1364,1610,2101,2807,2469,4966,3847,3628,4102,3138,3043,4846,1990,1272,1362,8,1182,649,3201,4286,687,4900,1684,1497,1799,587,4402,778,3840,1289,3650,4758,1972,3915,994,2175,461,1087,99,4804,2436,227,3904,4780,1263,1153,3520,3429,4567,3481,1484,3568,4207,4744,2352,38,1676,2773,786,1801,1450,2515,140,1097,1459,711,4467,616,3478,2774,566,1753,1658,2064,190,1732,4296,3264,1522,1386,81,2318,1331,2232,1696,4012,1350,4101,1377,2238,2409,1342,1166,3851,1036,1856,4592,3998,82,4245,3958,802,2086,4616,3934,290,306,2239,993,4789,2508,4740,890,3999,1963,1935,4091,4348,3434,628,3738,4456,3057,4558,2399,295,1254,330,204,1690,590,735,2163,1832,3973,2920,1257,1745,3041,1645,1201,1268,2564,36,379,3299,698,4653,232,594,4843,4000,763,2115,1011,3960,3564,997,1814,2227,2441,1629,395,2798,3289,2542,2111,830,2594,2090,4064,334,4154,2956,3388,2716,4705,4069,1190,1213,1782,2300,4860,4922,4028,863,4986,3630,1245,1579,3751,3160,4400,4237,3510,3177,144,3624,3412,2357,871,4752,4706,784,2673,2039,3534,1285,3042,2841,2199,1743,3416,4394,4629,2565,2903,2618,4435,3877,324,121,2337,4251,3455,4638,33,1877,4218,3955,2005,1776,1167,1979,509,2640,1525,216,422,4010,3546,503,4305,4594,610,178,1041,2741,4774,2736,358,1154,1720,552,564,3600,508,1356,3642,1400,3358,1487,26,368,2854,1509,93,2812,817,4831,1808,3856,2292,404,4234,3828,15,215,2543,3651,4302,2478,4201,1677,4525,3233,3795,1807,4160,2490,893,1501,4116,1175,3653,719,3711,1929,3754,2853,855,4114,2540,2132,1045,1346,4712,3696,3966,4958,2814,4020,258,1078,4906,2216,139,2689,3394,4720,1184,4067,98,2343,3868,870,1480,2270,2105,2603,822,3417,4903,2848,3750,4289,1803,4801,1938,2000,1946,4107,1899,757,2983,3846,3857,288,897,3316,3861,2228,2098,1464,3025,1080,2340,2982,4855,4074,4792,1742,1413,2079,760,4911,1727,4779,847,3996,4477,1557,4782,4920,1607,1527,1474,866,1276,2501,3117,176,1324,4377,4935,4441,3026,181,1749,34,2886,4810,4338,861,3062,1312,3219,1521,2908,4807,4724,388,3712,1329,3486,2010,1231,2142,903,2276,2788,3096,4882,2669,2916,3895,4169,1171,4303,723,3636,4661,246,2288,3064,664,3713,3408,907,1874,265,1109,2759,2905,35,4036,4668,1099,1500,3053,724,407,4857,3620,683,793,4259,4647,408,3572,1269,436,123,3588,973,4484,4785,839,729,4952,3974,2438,673,3371,4838,3664,2970,2688,3508,931,487,2170,4126,1700,1916,19,3809,2172,3893,1434,3301,4413,4885,1214,2008,4811,4764,2904,302,67,2933,623,3453,3141,4366,4375,146,692,3752,229,1883,3318,3063,2915,2585,4866,4673,2834,2468,4580,1798,3732,1399,812,1951,2100,4269,1227,736,1406,858,4258,1733,4489,2887,3495,4089,4526,2997,4325,4821,3611,3645,127,4355,878,3688,1964,2330,554,1711,1870,1855,3985,3399,2960,4226,41,694,4700,4480,4212,3395,3917,2294,3784,3770,4742,4769,2567,2395,4604,3517,2189,586,12,3666,1694,881,3276,1353,4442,4459,1172,1253,2990,758,2480,4285,4849,4519,4635,4387,781,3171,2569,4944,867,534,4802,975,4666,2355,2680,1621,3200,4527,2218,4198,1847,3542,4374,1411,2075,2768,565,1939,672,3300,2148,978,734,3647,665,1310,4293,2833,2082,2890,2962,1060,575,2919,1726,2390,1628,2758,2338,2607,923,1092,2223,2368,2957,3733,2562,3122,2102,159,838,1846,3293,2578,4886,2901,1390,2051,353,2846,1792,4650,1594,2638,4200,3100,2844,2383,1761,2872,2826,4340,1468,3185,309,1074,327,2626,3669,20,451,513,3343,2224,4949,3139,3069,4696,3957,4171,4096,4858,2917,168,617,3492,4267,3800,1471,3700,806,3243,3675,1558,4551,2729,2601,4432,1507,2577,171,2533,4768,740,4916,3352,1578,2687,2034,3015,315,2165,1937,4092,596,2855,212,4614,281,2018,1327,4844,3259,2991,773,1173,1478,3056,2113,4308,4971,4380,3497,32,4403,4098,3515,4914,224,679,1996,4543,558,1460,3796,4984,2941,4062,4878,1094,982,3031,4475,464,4043,1343,1259,4037,293,646,2068,2861,3173,1451,4343,2836,2241,1089,4759,4488,957,179,4775,442,3226,4031,2860,1100,4959,2791,1863,1103,184,4909,3850,3524,3889,1187,4297,1824,580,2167,4478,4990,3640,2727,716,3400,3805,1533,956,1871,4963,3528,4055,2677,4148,475,843,3039,166,1085,1467,2649,512,4434,1239,1958,4981,916,3282,3291,1144,790,1314,4282,2445,1009,1627,852,4401,3308,1317,132,2656,4344,1905,2193,4968,3392,1433,3279,1853,4586,2378,2511,452,3530,3989,3405,908,4373,4786,104,2821,108,3783,1051,3703,928,1762,2664,3220,3496,1622,977,2880,531,4452,1695,2052,1947,143,2173,331,262,631,2815,3328,2927,3452,1898,3158,2648,1336,2122,2544,400,4262,1117,2818,444,2690,568,3670,142,4761,2968,888,2808,4241,1604,90,2787,91,1229,1421,4633,2325,4735,4897,3604,381,4018,4123,4513,340,3648,2733,1183,2426,1875,203,86,4210,3038,3951,4469,4006,4225,3882,3867,3633,3485,3130,2140,2551,1664,4073,4534,478,4777,2754,2430,3586,4099,936,985,4449,4182,1952,2106,2663,4825,1126,3950,1215,4238,4464,438,3302,4723,4523,3162,1675,1149,1068,3995,2809,1649,1207,3928,3571,4002,706,4850,853,1355,4205,1347,2999,562,654,1771,153,1546,4940,2840,1820,1496,2242,1640,2867,4603,998,2072,2799,4265,4485,4753,803,3381,3513,2693,3954,1698,1705,196,4754,2650,2476,3923,349,4972,895,1783,3639,1758,621,3678,4544,2576,1442,1335,2375,3758,3862,2944,4588,1810,3577,3545,4315,3193,2137,2372,1151,1349,2950,1842,764,399,2235,4795,486,2080,4620,1572,3321,3125,4757,4179,2120,1580,313,3470,1105,970,1724,4288,1612,2935,3926,1066,2866,53,707,310,4206,3073,3440,1746,4597,2755,430,702,637,3378,851,3323,2588,339,535,510,4280,3367,3082,250,4131,2162,1577,1971,2263,2953,1391,4426,3267,3662,3250,3020,4631,3384,693,2271,2083,2894,2843,3570,1632,3674,776,1739,3045,360,173,544,1651,1093,4294,2346,1959,378,1667,1013,4211,1927,2705,1197,4250,753,4391,3817,1886,2958,4378,3059,3254,11,823,3635,3099,1769,2366,476,1205,4585,3701,1796,3404,4125,2914,1428,4191,541,2837,54,226,4044,2869,650,2212,3240,4034,1005,2200,676,1354,3919,1697,4937,431,2281,3885,4017,164,1028,2341,3549,1426,1925,1825,4639,2743,2488,2570,1008,1359,1475,3169,2073,2336,460,1538,3483,1567,1325,4571,540,225,3479,4176,4497,1775,3511,4634,1956,2126,300,3006,3526,3256,2386,2652,4995,2852,151,3507,1299,865,4913,1203,597,2145,1014,4879,2136,4823,3362,4290,3357,1138,2509,1210,2795,4261,4554,2001,1168,2724,3582,2510,62,3252,2236,2011,2483,4395,4851,209,547,4755,1768,1281,4358,2405,4110,2151,3120,4361,1950,4522,3845,946,2877,2984,3065,343,4082,2595,4032,1630,100,2949,51,1679,2492,1914,2868,571,2560,4719,4578,4309,3744,2783,1345,971,4646,4008,1960,4345,236,1962,3199,1357,1844,3239,738,4419,107,2283,3548,818,2348,3463,3373,4177,147,4275,2194,2264,3811,4143,70,549,1155,4372,3152,4498,1020,155,2087,3956,3155,80,1305,479,807,3627,792,2777,3391,3673,3672,103,2061,4978,2311,2571,188,244,2684,2884,1714,441,3859,3798,1773,759,3487,3874,4476,2965,3423,701,794,4703,3363,1995,1030,2461,4197,630,1709,2746,2742,1072,128,722,3132,3518,189,423,3464,1913,1216,345,2881,1987,3359,604,2402,1928,2623,2456,213,4852,2514,805,2240,4150,2164,3649,2197,4065,876,4499,2304,2749,4027,1566,1589,3826,165,471,1226,55,3665,551,75,4678,3829,4771,3361,3406,2042,110,4725,2896,3217,1532,1477,3248,323,4659,3903,2179,2849,1034,1850,3863,4797,767,230,3501,3506,2308,4763,4276,4939,854,1716,1300,4974,4134,553,2780,1701,1302,118,1069,4121,4692,24,3519,4694,4615,2737,3685,2974,175,2350,214,4621,3443,2437,710,4927,3437,4414,2055,841,3658,1591,1839,3370,1955,2772,4135,3940,1611,3825,875,2875,2756,2939,260,2143,2089,2536,2342,2382,2464,3228,4945,1473,1435,202,1689,3643,4748,248,1238,1483,2237,4833,1334,850,1845,2969,572,1446,3971,3445,3667,4818,1062,377,655,2661,788,4770,4630,4314,4058,2206,3872,4824,4969,1462,2289,2428,1319,2033,156,2021,3830,2938,4505,2099,2287,1772,4899,3498,4967,1220,1206,373,2423,4196,1592,2683,727,2995,1058,4677,4529,1867,2069,1290,4168,2118,3918,4950,2157,718,2036,2077,3704,2952,2186,2475,905,1932,2273,4142,2882,2370,1731,427,2303,4009,2769,4424,2028,4081,868,2811,115,3916,2471,2498,1176,4301,1765,4718,1352,1633,1730,1152,625,1644,3590,1427,1986,4332,1618,1603,4667,615,3203,2695,1333,887,3977,363,2633,4243,3268,245,2290,2327,1018,4912,4766,4158,4078,3663,4756,636,3779,474,37,3533,157,836,3212,3906,3419,4819,2326,3104,3450,3168,4521,1134,1920,3421,4856,3844,4115,473,2182,234,712,3612,2986,482,3305,1548,748,1530,967,3531,2465,4888,2972,933,1922,211,4208,4806,2473,4691,2948,4657,2299,3393,3972,3270,1511,2710,4324,935,2863,4537,2703,648,4884,2830,4717,2169,3067,134,3593,3249,1982,1549,1488,2827,4381,737,3786,883,681,4613,4385,873,2268,2050,1209,3346,2599,2659,1513,3766,3488,4360,2534,1823,1657,2497,480,308,2556,2084,4713,1719,4030,272,3537,1012,424,1129,599,4274,3695,3994,3681,383,3802,2519,2912,3019,1419,1440,195,1481,2058,4406,3339,421,1902,2377,1412,3589,872,1660,4842,3771,359,2442,126,1114,1495,4867,4392,3121,1678,4674,2583,1671,1204,3466,934,4928,1128,533,4931,4829,4524,4333,2552,4239,1492,2662,3181,2721,3755,1891,3076,2067,1330,3930,83,2448,925,4918,1707,3350,677,775,3607,3396,2211,1680,1417,4908,1224,1896,1585,3246,1230,2452,2666,501,618,3468,704,2906,1490,3332,1893,2009,2295,4929,766,4722,2177,1337,4672,4798,326,1693,3610,1222,415,2675,4132,1759,3493,1840,666,1605,2484,4095,829,519,2398,1728,2277,3529,2421,3072,1003,3127,2753,3188,2255,4137,3808,1024,2222,3879,3656,4602,525,2831,4118,715,4060,2254,3047,4891,141,4339,1351,2408,3587,591,3023,2862,3237,3563,2923,3255,3098,3727,2071,3499,930,2967,1983,2259,4277,1225,4141,4444,1338,959,1576,4109,1113,1414,845,2538,2635,4689,4352,1736,4839,502,4734,2048,2692,4623,2128,4149,2487,3969,3679,1491,2306,4492,4300,3641,3241,1198,696,2947,384,172,4729,3743,1291,4975,1586,3699,583,2678,2251,1617,1273,2353,2658,3238,1469,3402,2185,3326,1070,3982,2745,2417,4284,3709,4896,2794,774,3522,318,3430,920,1436,402,954,1237,4636,3967,821,2934,545,4992,4146,4698,1616,2793,751,3646,2712,393,3797,3021,46,1933,3884,4510,44,3438,4905,4611,96,4445,4606,2217,3154,682,660,1095,4876,3439,3111,3539,445,2109,3820,296,641,2044,241,4919,2166,1303,2354,3578,3157,1634,419,523,92,3724,1547,3505,4813,3034,483,114,3605,3029,42,1953,4440,2579,1061,2158,197,811,1767,4943,3715,882,4458,4991,1389,88,3932,1819,222,3106,1156,4418,3090,2665,3911,1791,1404,526,1461,3247,4016,2397,4655,3175,3227,2723,4035,4892,1892,884,1673,1552,921,958,4356,4562,4600,4832,937,1393,71,4247,2305,63,3364,2209,1625,906,1270,4644,158,2691,2975,1022,1363,2159,579,3782,742,1756,546,1021,581,2731,2210,2314,4310,3231,1502,4088,3907,3001,2747,350,1598,4172,578,1177,333,4077,299,1247,4042,3561,1941,4820,3799,992,2792,3512,609,2617,3446,4188,2081,160,3686,756,2181,4815,4129,800,3898,4430,7,1812,4390,429,1948,1652,1328,1809,4119,2108,3993,1301,3014,4531,2992,1921,1052,1256,2859,3768,1308,2718,3878,1195,2604,385,4951,1619,1655,3788,3891,2226,2049,3585,1712,3968,3892,1970,3660,2988,1090,4040,3457,4431,1277,4875,3447,2574,3555,2038,1884,2004,2320,3560,3431,4787,1185,2040,4446,4423,4396,1212,3853,4980,1241,4632,1620,1394,3178,3947,4398,3793,4573,4730,1635,3263,2630,717,362,3050,2521,2615,1789,754,1038,1165,2334,2728,2512,3619,2504,4641,3135,117,1541,745,4516,2297,3935,2959,713,4541,1596,1251,3717,1169,1717,891,3979,824,530,2453,3382,3347,3886,809,3051,2466,4323,3079,1713,3697,4518,4103,2932,2766,612,3147,3040,59,4019,1258,3288,573,3245,968,1800,481,4416,289,4583,2358,2248,4376,4610,1750,1365,3180,3123,2127,3986,4547,4791,634,4021,2951,2506,4187,642,2393,1286,914,3632,1,3148,4847,4138,286,1077,4530,1112,2114,4232,3864,450,4033,136,2025,3273,2112,1064,3353,254,1295,3933,4001,532,162,3261,426,4709,3179,2029,3092,3810,3929,3832,3274,3232,962,2006,3311,2771,2513,3151,825,4050,4853,3182,303,1869,4022,3105,3184,1999,3313,2116,4953,4068,459,2876,4658,4278,1194,2323,539,2963,1609,2850,2606,3559,2485,3939,561,2732,1997,2503,1662,640,3535,1608,2027,690,4683,1132,668,1881,2252,4106,21,1498,516,1829,3558,4157,1449,3221,3964,4321,1975,432,1388,488,3827,23,1574,4964,4710,3807,416,1174,964,2250,4589,2243,657,4283,951,261,3309,447,2153,1010,1659,3403,29,3342,2779,1848,4619,3931,1039,2979,2527,1443,1822,1246,4591,57,4902,4596,1392,653,4242,953,1145,2331,4520,2719,4268,3838,1083,4778,862,2030,2171,76,4762,4080,2347,297,4049,828,1373,3471,31,1930,4483,259,148,2477,2893,2775,1375,2624,284,280,3114,3085,1702,1827,3103,4675,2202,2789,4781,105,437,837,4979,613,3924,4552,1836,3599,9,1136,2954,274,3150,2231,4326,439,1280,4682,48,938,1279,543,3574,2285,2201,2762,1178,3975,3949,1766,2784,269,1287,1402,2023,647,4139,1304,3849,4368,1859,2078,207,3265,1600,601,2946,1143,2298,4271,1539,4715,2496,4450,2183,2396,4925,4155,3541,2096,4292,1221,1653,3980,536,4448,2439,3207,3608,3865,3883,3622,2698,3327,4281,3823,3159,3433,1981,3142,3109,2481,1236,3836,2363,1674,2367,4153,2557,335,3044,2711,3337,2274,2584,972,1555,2864,1358,3689,2801,1432,453,3822,2147,337,3334,3336,4796,4828,4533,3818,1980,4409,4491,2786,2824,826,4539,2022,74,941,291,1985,1969,801,1292,267,2526,2654,3921,2804,4861,4652,4989,2722,3746,391,2422,4760,2351,4163,3615,4910,2280,3081,1553,4973,942,85,4834,94,1518,1529,1372,4263,3140,4039,3813,1654,2149,3721,4765,685,3909,4609,2380,3028,2385,1248,2825,4072,511,965,3913,4079,3776,4626,4349,1321,4404,606,3003,2190,4437,3204,307,219,1903,2629,2873,95,864,4502,1340,1978,1002,3644,4334,3149,3812,2600,2735,2014,4726,979,1584,3459,990,364,4029,2517,242,1217,4869,3962,2207,1164,2433,1233,301,4512,2660,492,187,3707,1900,2706,2463,588,28,1774,3189,73,396,4598,1788,4697,2667,750,2076,498,285,1517,4681,2502,3866,2847,4075,3854,1817,1534,833,4997,2518,467,61,4144,678,4569,4542,4248,3236,4574,2221,2580,2597,3251,3804,4926,4473,191,443,4747,3905,4812,2345,4515,3657,4536,577,699,2874,4599,940,2012,1493,4934,4346,3052,2015,658,915,2450,3543,4405,2013,3890,1793,352,1993,2926,4133,4924,435,2195,2717,3088,3580,2796,4540,193,3093,2563,3216,2763,1348,1623,3875,499,2429,2529,4227,210,1374,1873,1309,4685,3414,1133,1828,3598,3692,582,2391,4216,3690,2845,3269,208,2219,1510,4466,1826,2608,2605,4651,4707,2319,3894,2820,3461,1889,1523,2160,3540,2123,624,101,1968,4936,2198,3482,1949,2322,2474,2817,1284,1118,256,3476,2002,3012,2470,3390,4202,3195,1638,2631,1037,1641,3278,4790,1926,4004,192,2467,2764,752,4560,1120,138,1755,3668,3880,4462,1409,4453,418,1102,2379,2568,4890,2419,1715,1514,721,614,4504,2857,732,3210,945,3187,3781,3638,639,3303,1880,239,2572,1311,387,2035,1006,1361,3295,2790,1189,3409,3174,667,1398,1380,1915,902,3022,4699,3835,4670,3584,4231,4535,2249,2362,791,1670,1040,4645,4517,2265,3728,4737,1934,4085,4690,1131,1602,4622,3936,348,1597,4898,1909,4649,2045,1831,1647,909,848,4047,2725,3205,3839,1104,1266,2131,1967,949,1721,2486,2822,834,3386,3976,4266,1780,4329,3083,846,4117,4181,4108,3136,4120,3736,1235,485,1537,1476,3896,4965,3821,1703,2313,3436,4793,1575,2489,2879,2104,4893,4438,3552,1910,2063,1998,4059,3553,3070,3575,401,342,4254,4889,3376,3925,4482,3161,1954,2715,3320,4746,1706,989,1888,1704,4514,1681,2554,886,84,1785,3953,58,3557,3192,4704,1341,3623,1043,1894,1395,2156,1587,739,4684,2135,4084,521,652,2154,1096,3990,3816,4845,651,2301,1691,319,770,859,3297,4365,1081,2943,4364,413,1306,2444,420,282,489,2978,4379,1027,3942,4189,2091,3858,1179,705,4532,2178,2911,4559,3984,522,355,4708,4213,154,4357,247,2566,129,1907,1601,3460,4046,1053,2686,1943,2765,622,1485,220,2196,3625,3504,2427,684,2614,1508,1708,3785,3108,3422,4490,3815,2546,3801,4827,2388,1148,4111,2389,1015,1520,3927,4190,3538,428,1042,1613,3330,4330,4474,983,454,3229,1108,947,4501,584,1403,3870,3049,2184,2092,1275,87,1384,1067,2451,2284,981,3166,2548,1048,3037,629,725,3397,1554,1499,3983,898,4481,2942,4038,4270,2802,3737,520,3235,518,1107,3074,4808,3133,65,1661,3659,1851,1544,1917,4805,2676,2586,3693,2344,4904,2707,4627,131,607,999,1994,2410,1444,4256,1001,3075,3655,4455,2550,2117,1944,4830,1861,4295,2037,3710,4249,2609,1420,3941,743,4895,1581,2208,3341,4549,3377,1965,455,3473,1563,1813,366};
long long Bob(std::vector<std::pair<int,int>> edges)
{
int N = 5000;
long long k=0;
for(auto [x,y]:edges)
{
if(y==N-1)
{
for(int i=1;i<=N-3;i++)
if(nrmb[i]==x)
k = (k|(1LL<<(i%60)));
}
}
return k;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
820 KB |
Correct. |
2 |
Incorrect |
2 ms |
820 KB |
Incorrect answer. |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
820 KB |
Correct. |
2 |
Incorrect |
2 ms |
820 KB |
Incorrect answer. |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
820 KB |
Correct. |
2 |
Incorrect |
2 ms |
820 KB |
Incorrect answer. |
3 |
Halted |
0 ms |
0 KB |
- |