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"There is a pool of length l where n swimmers plan to swim. People start swimming at the same time (at the time moment 0 ), but you can assume that they take different lanes, so they don't interfere with each other. Each person swims along the following route: they start at point 0 and swim to point l with constant speed (which is equal to v_i units per second for the i -th swimmer). After reaching the point l , the swimmer instantly (in negligible time) turns back and starts swimming to the point 0 with the same constant speed. After returning to the point 0 , the swimmer starts swimming to the point l , and so on. Let's say that some real moment of time is a meeting moment if there are at least two swimmers that are in the same point of the pool at that moment of time (that point may be 0 or l as well as any other real point inside the pool). The pool will be open for t seconds. You have to calculate the number of meeting moments while the pool is open. Since the answer may be very large, print it modulo 10^9 + 7 . The first line contains two integers l and t ( 1 <= l, t <= 10^9 ) -- the length of the pool and the duration of the process (in seconds). The second line contains the single integer n ( 2 <= n <= 2 cdot 10^5 ) -- the number of swimmers. The third line contains n integers v_1, v_2, ... , v_n ( 1 <= v_i <= 2 cdot 10^5 ), where v_i is the speed of the i -th swimmer. All v_i are pairwise distinct. Print one integer -- the number of meeting moments (including moment t if needed and excluding moment 0 ), taken modulo 10^9 + 7 . In the first example, there are three meeting moments: "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
211523706 |
liuhengxi |
F |
June 29, 2023, 4:29 p.m. |
OK |
GNU C++14 |
TESTS |
41 |
436 |
23244800 |
|
|
211564116 |
ftt2333 |
F |
June 30, 2023, 2:50 a.m. |
OK |
GNU C++14 |
TESTS |
41 |
452 |
14438400 |
|
|
211569077 |
zddtuus |
F |
June 30, 2023, 4:15 a.m. |
OK |
GNU C++14 |
TESTS |
41 |
1871 |
75571200 |
|
|
211551408 |
Ant_Man |
F |
June 29, 2023, 9:21 p.m. |
OK |
GNU C++17 |
TESTS |
41 |
452 |
16486400 |
|
|
211547524 |
penguinhacker |
F |
June 29, 2023, 8:01 p.m. |
OK |
GNU C++17 |
TESTS |
41 |
1325 |
77209600 |
|
|
211531778 |
ToTLeS |
F |
June 29, 2023, 4:59 p.m. |
OK |
GNU C++17 |
TESTS |
41 |
1466 |
85094400 |
|
|
211530191 |
rniya |
F |
June 29, 2023, 4:48 p.m. |
OK |
GNU C++17 (64) |
TESTS |
41 |
233 |
10342400 |
|
|
211556756 |
wsyear |
F |
June 29, 2023, 11:52 p.m. |
OK |
GNU C++17 (64) |
TESTS |
41 |
374 |
40243200 |
|
|
211570272 |
chappy1 |
F |
June 30, 2023, 4:38 a.m. |
OK |
GNU C++17 (64) |
TESTS |
41 |
576 |
49356800 |
|
|
211557107 |
Larry0101 |
F |
June 30, 2023, 12:02 a.m. |
OK |
GNU C++17 (64) |
TESTS |
41 |
576 |
49356800 |
|
|
211527973 |
Sanhehui |
F |
June 29, 2023, 4:37 p.m. |
OK |
GNU C++17 (64) |
TESTS |
41 |
607 |
42291200 |
|
|
211561803 |
Alex_Wei |
F |
June 30, 2023, 2:06 a.m. |
OK |
GNU C++17 (64) |
TESTS |
41 |
1590 |
109465600 |
|
|
211561781 |
EternalAlexander |
F |
June 30, 2023, 2:05 a.m. |
OK |
GNU C++17 (64) |
TESTS |
41 |
2480 |
334438400 |
|
|
211557844 |
244mhq |
F |
June 30, 2023, 12:24 a.m. |
OK |
GNU C++17 (64) |
TESTS |
41 |
2682 |
75366400 |
|
|
211563751 |
yingluosanqian |
F |
June 30, 2023, 2:44 a.m. |
OK |
GNU C++20 (64) |
TESTS |
41 |
265 |
66867200 |
|
|
211526813 |
abc864197532 |
F |
June 29, 2023, 4:34 p.m. |
OK |
GNU C++20 (64) |
TESTS |
41 |
342 |
24268800 |
|
|
211559571 |
njwrz |
F |
June 30, 2023, 1:10 a.m. |
OK |
GNU C++20 (64) |
TESTS |
41 |
342 |
44441600 |
|
|
211561085 |
wsday |
F |
June 30, 2023, 1:49 a.m. |
OK |
GNU C++20 (64) |
TESTS |
41 |
374 |
16896000 |
|
|
211562878 |
wsday |
F |
June 30, 2023, 2:28 a.m. |
OK |
GNU C++20 (64) |
TESTS |
41 |
390 |
16896000 |
|
|
211547361 |
Kira_1234 |
F |
June 29, 2023, 7:58 p.m. |
OK |
GNU C++20 (64) |
TESTS |
41 |
546 |
71577600 |
|
|
211528951 |
memset0c |
F |
June 29, 2023, 4:41 p.m. |
OK |
GNU C++20 (64) |
TESTS |
41 |
654 |
78745600 |
|
|
211529098 |
bkifhr7 |
F |
June 29, 2023, 4:42 p.m. |
OK |
GNU C++20 (64) |
TESTS |
41 |
670 |
78745600 |
|
|
211558652 |
qiuzx |
F |
June 30, 2023, 12:44 a.m. |
OK |
GNU C++20 (64) |
TESTS |
41 |
670 |
85196800 |
|
|
211526845 |
physics0523 |
F |
June 29, 2023, 4:34 p.m. |
OK |
GNU C++20 (64) |
TESTS |
41 |
904 |
97587200 |
|
|
remove filters
Back to search problems