CT42944

The XOR Ledger of the Violet beacons

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the acacia flats of Thornveld. Paige spreads the beacons records across the table and picks up a sharp pencil. 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: 3333 1823 1208590611 104550074 1617452093 1322894977 1252915313 1074943409 498870999 1787716058 542964771 707138236 1392409307 1520102716 1284022947 1845734847 2047921653 786797803 1001865069 338551417 692566140 1075924966 786205845 382948475 685181481 187587799 1295933974 1012060736 1168579571 190385620 2064900244 1248654511 551886316 1537548563 121245182 137587770 1897704338 839545141 1593760820 1993327887 594919713 1955118661 1438133252 1724726498 2080568978 42312518 160679125 320909891 1075580903 102816629 437840805 828816113 1430511196 1945668586 1772584801 124508579 1791309750 489609161 54884359 1530391858 1930838726 560433927 371352866 1271641936 640720681 755069960 1857607406 190039473 99149207 1392924712 420548723 1401825773 485812869 1522832738 1603629190 864207635 1536441002 931…
Output: 306840525 974821372 1330031859 1244317239 2040597926 826780879 1973559214 1765604195 98427823 1842589240 606047353 2120189309 1453669910 1779777547 656339620 1852927906 1976720190 695131286 66407323 634063960 1592260098 1190193874 2107110265 1298721446 1960797761 849504023 897059696 515502908 1761242951 122689850 1837606617 971145903 125304584 1522946821 1852456901 1175862056 401474406 2076040282 25217978 1494861290 1159360691 398361547 828775502 1642362102 2143478039 618298572 518217642 2016330233 1180830258 1753689546 56610135 1513684498 1432960635 1146219082 1794554308 532541579 360921421 795935444 355964583 1739007104 128115153 1014971021 2036645233 1228856544 773089174 218606664 1076098978 584981330 1932410707 1963852573 1799485603 1087901570 772570278 1872221651 279868136 1105570800 …

Example 2:

Input: 206 3204 1387292358 1562331726 983461647 141629009 2072160488 1074941245 172272871 2117462423 1735439882 1451024289 2069388758 1475023173 1526227602 1758042141 168553102 328333058 116161864 2049118756 33631803 1420983914 166265871 1726419906 327227544 1278012324 282095319 9670032 2086078472 1336202019 2055907145 88294523 796928843 2061455460 121616989 486075254 1202996502 777810157 1048980967 1449390927 558790251 2049527039 1075237262 108369032 1507218744 1707126472 660021886 381204873 1569774002 1201685999 1021687145 1180758443 355818821 478991798 1576137569 1347048498 1693495136 1260097199 367660266 383815913 538607634 1486305898 1744452036 804942134 1561990968 48872185 373873722 1335938444 1902650159 6312534 131777462 1027286568 33056642 17165126 856308119 1047216908 60071626 738429975 …
Output: 41680543 708667744 290933956 518840241 690773850 583662908 1828384692 792181201 1534369544 992236790 2073668451 169955024 344300684 1269570829 1239832834 823057145 1843034514 500137518 1048099687 1455923414 573791108 1934320795 1903307460 1241275343 228334154 1641600662 1536916476 1782548285 436481324 730601428 630171857 1804008941 851388511 1544982256 1148525377 1984906077 359933391 994045670 1928226545 1758184456 2100094035 1409224206 455589734 857715693 1538407427 74507818 1491305242 769018099 102284359 118927186 2086839384 1014899945 1420175350 1740205811 488550367 1900681246 1733372713 1628453706 987784778 1463153246 987784778 2057353842 1507508945 1140470778 1020232823 2032278080 618511085 1287752479 819265953 1472488362 1254741038 1706281624 1856490280 861979502 80975267 1993003882 …

Example 3:

Input: 1023 3897 608127877 196278991 1057553921 1122925920 1946424756 652096854 705884902 245673532 842156359 1335631611 859418845 187246615 1408032751 282933230 172263910 272356743 2117784635 1892945474 852825485 1363044672 388578940 1876105237 1327203041 1751153052 2035530801 903458153 406496454 969506260 212063896 1620035722 1741456708 491816112 1955674152 231892459 1895626515 1666166680 1456202119 1241034497 2146256924 492534146 317478515 1195552057 1806083339 362952762 1529510097 1734889558 185257043 1462024564 1554613898 99359546 1019508284 1396277828 889355221 1356514530 1979248514 45540310 758912552 1751253434 735624825 1474947203 1922537598 1048144633 491817470 1628203282 672967743 1264321448 933282437 77703192 1524637367 1196330023 1580171028 1556923340 280391074 1841557008 1024209023 6…
Output: 1875122514 1640406335 837204312 456541 871446948 957258666 2005474619 1060244803 1092222761 875816924 733893428 684930692 1191141779 2138545645 894678777 1591163592 1874811767 1645677659 2078541002 1927891835 1708063451 395533659 502911079 867862453 397885498 268090071 1220545170 982782392 727826762 1579607726 772991182 845846357 375091026 1852533579 1575153031 1618774641 136271141 1325168573 236809983 733564971 1097348962 1424290759 1666739908 1808894158 881059029 630361831 1347993649 75986744 459532929 22777368 384499130 1125993675 1683739805 1850655832 1736620384 1674593923 156941267 279623490 864547785 725686227 543108513 174132691 1404088303 1451138936 2001505265 231381092 1784154325 933570208 1129618797 1111143158 109690718 1658697425 376768277 1520457915 1396797901 916146134 6652313…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The XOR Ledger of the Violet beacons - MEDIUM Coding Problem | CodeTikki