CT49594

Fiora and the XOR Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The council of the maple sugarbush of Saprun pays by the answer, and Fiora intends to earn it. First: the full register of marks. Task: Answer q queries 'l r' giving the XOR of a[l..r] (1-based, inclusive). Input format: First line: n and q. Second line: n integers. Next q lines: l r. Output format: Print one XOR per query. Constraints: 1 <= n,q <= 4000; 0 <= a[i] < 2^31; 1 <= l <= r <= n.

Example 1:

Input: 767 1565 467417779 880219261 1545719318 1366638692 1172205880 46530491 623977214 751075892 2112099002 1278526784 1323825667 1865138508 877689041 558552931 1303025256 1273004962 1345750455 1386571001 1310260542 1846711873 2002843806 2007309623 592659346 854222439 1786405775 365676389 183934235 1612228678 1582670038 831768295 1046284759 861462275 526800707 343792222 1844750466 1018658413 1505586689 1078976743 1573729104 1896557506 1152487912 855422838 527190368 94141639 115741116 1646871126 127785600 2123560783 706204193 619029332 694495275 1233544661 993778868 482191656 43257082 874691251 905353899 1445050370 2139984382 802125681 917635224 344000082 1779585855 1917811135 1017897489 260139283 562427204 1920371419 1489474160 749594345 106657803 1799160200 357452300 176512989 1979781619 150115…
Output: 340840019 853075140 311055565 1068817024 2083226716 1606653064 1431925921 1899467261 799988196 972808436 738588435 1406556749 166158912 422034887 1154678140 522562188 948720598 1417877969 84380494 288624047 309615048 245975444 1117522799 433425295 1779407671 1316855857 1901813798 1832549938 357760024 1615532947 426024108 499293029 1934432188 1400658022 1357935839 1584352908 556766606 677976656 211023157 1052786039 723328531 73243115 157048104 1791312709 1599777506 1238246617 1377562808 719194639 265170581 2017783686 2088433624 1765936591 354979320 408970523 1998113155 1487835438 364754979 1717566008 1817067808 1626870372 1286651189 1810623820 1346178023 887405873 1650757542 1944210331 2037908680 1325467465 258512941 901465146 529095899 2040403373 1678948110 774675064 1028770483 566124731 1…

Example 2:

Input: 925 1712 340990271 61727708 538743200 1602714525 285655012 878927278 1654129313 294600374 1274485510 85364388 1329564344 1518200297 690719457 1917454336 863057825 911469483 586853931 114030696 1355425544 392656998 1118127683 2082413607 155075434 1704575845 1657936478 1144506296 480358250 987908232 1181699045 1431965799 1036990829 632960285 689782414 51465433 1108917001 499093103 492561587 1763782726 1409786276 779613626 1994582048 2003868824 783111460 776188738 76072992 363757512 1503561392 1224491534 828486735 809969717 122199777 285052506 1981972746 675369489 1891537342 1521770268 224164546 1014294394 1932385800 638432379 584673497 1323598156 624699256 1829152255 482023936 1546763841 532306278 1433815626 915556253 1264325025 1483292690 1624849182 1853939073 1248647007 1760917888 11825723…
Output: 189408268 1584976411 143349599 1005428433 1794123439 1047851728 366971709 1519354929 1160794907 953772761 1169181470 532365426 1247995096 390216744 1914390135 1546991580 794254942 162921682 1197515219 1275763363 1136540995 491996249 574608293 1631887595 883720643 1669643861 374664308 1743470553 1507449312 560919825 510782319 863392158 1266124757 243948056 871517109 415162372 1552821986 135556767 1011002539 31999459 1546576537 137384180 1549946182 640170291 1908281952 1853619316 1908277277 922710529 1250576214 175273746 1898610303 1273853710 1108867975 1363838257 1234800864 867329753 567219556 1823929202 975655224 526971336 1391411824 1996011906 641626227 800367767 891018187 99720555 1050776337 1158610080 424560894 13851163 664847850 248735706 1810171082 232307379 1238028502 824274084 17655…

Example 3:

Input: 2042 1608 1359300426 1734539509 705860724 50727429 518119413 1492085416 1597970272 613227085 981034868 1661539029 958505275 1887500950 316739057 1138879602 1876672818 1167965606 503822243 804032121 1127920546 816411610 1773423667 1311235796 116028569 1492047455 526876420 380281645 2142863046 286413967 1689496062 1114400903 409208842 1902105864 781027273 256901461 724867953 825943157 470387932 1010124799 962164430 185619344 889294845 1669351609 553685939 185817748 1090507091 1126175531 29771698 2096755671 379134037 687434378 1796956430 1536452724 11834027 968684695 491328932 414951657 530481090 849040208 1101322164 704234773 742008377 1105313756 1207661357 1299010463 202301761 596403709 1629774323 1680437756 879672348 1776322567 498461538 47843752 115423825 1609237494 370251580 2044208425 2…
Output: 1295654630 1940497858 32588098 549155127 1651231827 1572979107 414783280 1394396100 741112267 532437022 1006280363 1434710391 916509559 67324053 975199175 2084734893 1355973937 1307260408 712180852 1892307146 183867810 1399527691 1452057305 1557245764 424099237 1230264938 945800837 1802019977 1041268734 1413477226 603364504 480402972 1637419196 53985933 117431031 1815224895 1004930801 553371664 230517171 182205249 654021671 379470892 455526165 1025462651 72575956 1241843717 15181836 376297938 1068279813 37465827 217425708 1146173125 1243919482 1697256044 954372440 1780987512 842913734 265695520 2094961263 2143121338 133056793 908198570 1837358395 1961443569 348119286 1266596120 1471780402 453723409 2097843234 1687812407 416211218 1284216787 278921409 1061445725 1363455574 1848072234 523728…

Constraints:

1 <= n,q <= 4000; 0 <= a[i] < 2^31; 1 <= l <= r <= n.

Loading...
Test Cases:No test cases
No test cases available.
Fiora and the XOR Ledger - MEDIUM Coding Problem | CodeTikki