Solutions are presented as using the least memory and the fastest execution time. It also takes the top
10 most recent solutions from each language. If you want to limit to a specific index, click the
"Solved" button and go to that problem.
Problems
B"Yura owns a quite ordinary and boring array a of length n . You think there is nothing more boring than that, but Vladik doesn't agree! In order to make Yura's array even more boring, Vladik makes q boring queries. Each query consists of two integers x and y . Before answering a query, the bounds l and r for this query are calculated: l = (last + x) bmod n + 1 , r = (last + y) bmod n + 1 , where last is the answer on the previous query (zero initially), and bmod is the remainder operation. Whenever l > r , they are swapped. After Vladik computes l and r for a query, he is to compute the least common multiple (LCM) on the segment [l; r] of the initial array a modulo 10^9 + 7 . LCM of a multiset of integers is the smallest positive integer that is divisible by all the elements of the multiset. The obtained LCM is the answer for this query. Help Vladik and compute the answer for each query! The first line contains a single integer n ( 1 <= n <= 10^5 ) -- the length of the array. The second line contains n integers a_i ( 1 <= a_i <= 2 cdot 10^5 ) -- the elements of the array. The third line contains a single integer q ( 1 <= q <= 10^5 ) -- the number of queries. The next q lines contain two integers x and y each ( 1 <= x, y <= n ) -- the description of the corresponding query. Print q integers -- the answers for the queries. Consider the example: "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
94701883 |
Yukikaze_ |
F |
Oct. 4, 2020, 5:35 p.m. |
OK |
GNU C++11 |
TESTS |
48 |
764 |
369664000 |
|
|
94705769 |
tfg |
F |
Oct. 4, 2020, 5:49 p.m. |
OK |
GNU C++11 |
TESTS |
48 |
888 |
327168000 |
|
|
94725608 |
AQT |
F |
Oct. 5, 2020, 12:05 a.m. |
OK |
GNU C++11 |
TESTS |
49 |
1700 |
449843200 |
|
|
94705379 |
2018LZY |
F |
Oct. 4, 2020, 5:48 p.m. |
OK |
GNU C++11 |
TESTS |
48 |
2012 |
372633600 |
|
|
94713772 |
TradeMaster |
F |
Oct. 4, 2020, 6:44 p.m. |
OK |
GNU C++11 |
TESTS |
49 |
2308 |
277913600 |
|
|
94721711 |
Mohamed.Sobhy |
F |
Oct. 4, 2020, 9:23 p.m. |
OK |
GNU C++11 |
TESTS |
49 |
2324 |
213913600 |
|
|
94729246 |
CupCapCup |
F |
Oct. 5, 2020, 2:17 a.m. |
OK |
GNU C++14 |
TESTS |
49 |
982 |
487628800 |
|
|
94703206 |
pikmike |
F |
Oct. 4, 2020, 5:40 p.m. |
OK |
GNU C++14 |
TESTS |
48 |
1153 |
244838400 |
|
|
94703210 |
smtcoder |
F |
Oct. 4, 2020, 5:40 p.m. |
OK |
GNU C++14 |
TESTS |
48 |
1294 |
441958400 |
|
|
94735488 |
rivalq |
F |
Oct. 5, 2020, 4:40 a.m. |
OK |
GNU C++14 |
TESTS |
50 |
1294 |
490393600 |
|
|
94724419 |
IllSurelyNeverSmurf |
F |
Oct. 4, 2020, 11 p.m. |
OK |
GNU C++14 |
TESTS |
49 |
1544 |
445337600 |
|
|
94724249 |
IllSurelyNeverSmurf |
F |
Oct. 4, 2020, 10:54 p.m. |
OK |
GNU C++14 |
TESTS |
49 |
1684 |
488038400 |
|
|
94708496 |
dlalswp25 |
F |
Oct. 4, 2020, 5:59 p.m. |
OK |
GNU C++14 |
TESTS |
48 |
1996 |
145817600 |
|
|
94711007 |
dum4ss |
F |
Oct. 4, 2020, 6:23 p.m. |
OK |
GNU C++14 |
TESTS |
48 |
2059 |
216780800 |
|
|
94718275 |
sh1194 |
F |
Oct. 4, 2020, 7:53 p.m. |
OK |
GNU C++17 |
TESTS |
49 |
483 |
68608000 |
|
|
94718129 |
sh1194 |
F |
Oct. 4, 2020, 7:50 p.m. |
OK |
GNU C++17 |
TESTS |
49 |
499 |
68608000 |
|
|
94718052 |
sh1194 |
F |
Oct. 4, 2020, 7:49 p.m. |
OK |
GNU C++17 |
TESTS |
49 |
499 |
68608000 |
|
|
94718373 |
sh1194 |
F |
Oct. 4, 2020, 7:55 p.m. |
OK |
GNU C++17 |
TESTS |
49 |
514 |
68608000 |
|
|
94718459 |
sh1194 |
F |
Oct. 4, 2020, 7:57 p.m. |
OK |
GNU C++17 |
TESTS |
49 |
546 |
68608000 |
|
|
94702580 |
KrK |
F |
Oct. 4, 2020, 5:37 p.m. |
OK |
GNU C++17 |
TESTS |
48 |
561 |
41676800 |
|
|
94711777 |
Amoo_Safar |
F |
Oct. 4, 2020, 6:27 p.m. |
OK |
GNU C++17 |
TESTS |
48 |
748 |
49049600 |
|
|
94731566 |
willingox |
F |
Oct. 5, 2020, 3:14 a.m. |
OK |
GNU C++17 |
TESTS |
49 |
748 |
492851200 |
|
|
94700640 |
hank55663 |
F |
Oct. 4, 2020, 5:30 p.m. |
OK |
GNU C++17 |
TESTS |
48 |
810 |
209408000 |
|
|
94720139 |
meowmeow321 |
F |
Oct. 4, 2020, 8:38 p.m. |
OK |
GNU C++17 |
TESTS |
49 |
841 |
440115200 |
|
|
94738917 |
ecnerwala |
F |
Oct. 5, 2020, 5:43 a.m. |
OK |
GNU C++17 (64) |
TESTS |
50 |
374 |
66969600 |
|
|
94734426 |
DimmyT |
F |
Oct. 5, 2020, 4:17 a.m. |
OK |
GNU C++17 (64) |
TESTS |
50 |
467 |
247193600 |
|
|
94725323 |
ecnerwala |
F |
Oct. 4, 2020, 11:50 p.m. |
OK |
GNU C++17 (64) |
TESTS |
49 |
468 |
66662400 |
|
|
94734572 |
DimmyT |
F |
Oct. 5, 2020, 4:21 a.m. |
OK |
GNU C++17 (64) |
TESTS |
50 |
468 |
248012800 |
|
|
94734326 |
DimmyT |
F |
Oct. 5, 2020, 4:15 a.m. |
OK |
GNU C++17 (64) |
TESTS |
50 |
482 |
248012800 |
|
|
94721211 |
LiChenKoh |
F |
Oct. 4, 2020, 9:07 p.m. |
OK |
GNU C++17 (64) |
TESTS |
49 |
514 |
372224000 |
|
|
94700109 |
jiangly |
F |
Oct. 4, 2020, 5:28 p.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
514 |
495616000 |
|
|
94721043 |
LiChenKoh |
F |
Oct. 4, 2020, 9:02 p.m. |
OK |
GNU C++17 (64) |
TESTS |
49 |
530 |
372224000 |
|
|
94717776 |
neal |
F |
Oct. 4, 2020, 7:43 p.m. |
OK |
GNU C++17 (64) |
TESTS |
49 |
530 |
402022400 |
|
|
94717496 |
neal |
F |
Oct. 4, 2020, 7:38 p.m. |
OK |
GNU C++17 (64) |
TESTS |
49 |
545 |
490291200 |
|
|
94720365 |
Taran_1407 |
F |
Oct. 4, 2020, 8:44 p.m. |
OK |
Java 8 |
TESTS |
49 |
2028 |
206950400 |
|
|
94719058 |
Tlatoani |
F |
Oct. 4, 2020, 8:10 p.m. |
OK |
Kotlin |
TESTS |
49 |
2714 |
207769600 |
|
|
remove filters
Back to search problems