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'n ants are on a circle of length m. An ant travels one unit of distance per one unit of time. Initially, the ant number i is located at the position si and is facing in the direction di (which is either L or R). Positions are numbered in counterclockwise order starting from some point. Positions of the all ants are distinct. All the ants move simultaneously, and whenever two ants touch, they will both switch their directions. Note that it is possible for an ant to move in some direction for a half of a unit of time and in opposite direction for another half of a unit of time. Print the positions of the ants after t time units. The first line contains three integers n, m and t (2 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x893 xc2 xb7105, xe2 x80 x892 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89m xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89109, xe2 x80 x890 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89t xe2 x80 x89 xe2 x89 xa4 xe2 x80 x891018) -- the number of ants, the length of the circle and the number of time units. Each of the next n lines contains integer si and symbol di (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89si xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89m and di is either L or R) -- the position and the direction of the i-th ant at the start. The directions L and R corresponds to the clockwise and counterclockwise directions, respectively. It is guaranteed that all positions si are distinct. Print n integers xj -- the position of the j-th ant after t units of time. The ants are numbered from 1 to n in order of their appearing in input. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
18895966 |
TsReaper |
F |
July 5, 2016, 8:28 a.m. |
OK |
GNU C |
TESTS |
30 |
296 |
6041600 |
|
2800 |
17544384 |
yaoling1997 |
F |
April 27, 2016, 5:19 p.m. |
OK |
GNU C++ |
TESTS |
30 |
233 |
12595200 |
|
2800 |
26886010 |
_ShadowSong |
F |
May 5, 2017, 5:24 p.m. |
OK |
GNU C++ |
TESTS |
30 |
234 |
6451200 |
|
2800 |
16970821 |
fanzhirui |
F |
March 27, 2016, 12:17 p.m. |
OK |
GNU C++ |
TESTS |
30 |
234 |
8294400 |
|
2800 |
18638813 |
SoiMae |
F |
June 22, 2016, 1:25 a.m. |
OK |
GNU C++ |
TESTS |
30 |
234 |
9420800 |
|
2800 |
17012325 |
gyz_gyz |
F |
March 29, 2016, 12:51 a.m. |
OK |
GNU C++ |
TESTS |
30 |
234 |
14028800 |
|
2800 |
28341030 |
dhuacm11 |
F |
July 7, 2017, 4:39 a.m. |
OK |
GNU C++ |
TESTS |
30 |
248 |
6656000 |
|
2800 |
17301951 |
Philipsweng |
F |
April 13, 2016, 12:47 p.m. |
OK |
GNU C++ |
TESTS |
30 |
248 |
8396800 |
|
2800 |
35887553 |
______M______ |
F |
March 3, 2018, 2:06 p.m. |
OK |
GNU C++ |
TESTS |
30 |
249 |
6758400 |
|
2800 |
28256901 |
vjudge1 |
F |
July 3, 2017, 1:35 p.m. |
OK |
GNU C++ |
TESTS |
30 |
249 |
6860800 |
|
2800 |
17384222 |
Zarxdy34 |
F |
April 19, 2016, 7:26 a.m. |
OK |
GNU C++ |
TESTS |
30 |
249 |
6860800 |
|
2800 |
28297851 |
dhuacm6 |
F |
July 5, 2017, 7:42 a.m. |
OK |
GNU C++11 |
TESTS |
30 |
171 |
15872000 |
|
2800 |
28295954 |
dhuacm1 |
F |
July 5, 2017, 6:27 a.m. |
OK |
GNU C++11 |
TESTS |
30 |
171 |
15872000 |
|
2800 |
28295935 |
corn_w |
F |
July 5, 2017, 6:26 a.m. |
OK |
GNU C++11 |
TESTS |
30 |
171 |
15872000 |
|
2800 |
40984716 |
ReaLNero1 |
F |
July 30, 2018, 7:32 p.m. |
OK |
GNU C++11 |
TESTS |
30 |
187 |
13824000 |
|
2800 |
50348871 |
zstu_MingSD |
F |
Feb. 23, 2019, 7:39 a.m. |
OK |
GNU C++11 |
TESTS |
30 |
218 |
6041600 |
|
2800 |
19359008 |
nobystander |
F |
July 23, 2016, 7:35 a.m. |
OK |
GNU C++11 |
TESTS |
30 |
218 |
6041600 |
|
2800 |
19072746 |
KFDong |
F |
July 13, 2016, 12:29 p.m. |
OK |
GNU C++11 |
TESTS |
30 |
218 |
6041600 |
|
2800 |
45252513 |
KCSC |
F |
Nov. 3, 2018, 5:25 p.m. |
OK |
GNU C++11 |
TESTS |
30 |
218 |
11366400 |
|
2800 |
51794435 |
pufanyi |
F |
March 24, 2019, 2:21 p.m. |
OK |
GNU C++11 |
TESTS |
30 |
218 |
12083200 |
|
2800 |
65910553 |
jslijin |
F |
Nov. 28, 2019, 12:45 p.m. |
OK |
GNU C++11 |
TESTS |
30 |
233 |
4608000 |
|
2800 |
44356157 |
vjudge3 |
F |
Oct. 15, 2018, 12:32 p.m. |
OK |
GNU C++14 |
TESTS |
30 |
202 |
10752000 |
|
2800 |
50670906 |
ArcherYH |
F |
March 2, 2019, 6:55 a.m. |
OK |
GNU C++14 |
TESTS |
30 |
234 |
4812800 |
|
2800 |
50347829 |
NotNight |
F |
Feb. 23, 2019, 7:11 a.m. |
OK |
GNU C++14 |
TESTS |
30 |
249 |
40038400 |
|
2800 |
50352021 |
walht |
F |
Feb. 23, 2019, 8:57 a.m. |
OK |
GNU C++14 |
TESTS |
30 |
264 |
9625600 |
|
2800 |
52149736 |
tsutaj1458 |
F |
April 1, 2019, 11:08 a.m. |
OK |
GNU C++14 |
TESTS |
30 |
265 |
9932800 |
|
2800 |
64796273 |
19991121 |
F |
Nov. 13, 2019, 1 p.m. |
OK |
GNU C++14 |
TESTS |
30 |
265 |
12083200 |
|
2800 |
26975383 |
spencer |
F |
May 9, 2017, 2:11 p.m. |
OK |
GNU C++14 |
TESTS |
30 |
265 |
12390400 |
|
2800 |
32496660 |
NiroBC |
F |
Nov. 20, 2017, 10:57 a.m. |
OK |
GNU C++14 |
TESTS |
30 |
280 |
9625600 |
|
2800 |
28272255 |
demerzel |
F |
July 4, 2017, 6:24 a.m. |
OK |
GNU C++14 |
TESTS |
30 |
280 |
11571200 |
|
2800 |
25295045 |
saliii |
F |
March 6, 2017, 2:34 p.m. |
OK |
GNU C++14 |
TESTS |
30 |
280 |
14233600 |
|
2800 |
68658795 |
hjk1030 |
F |
Jan. 12, 2020, 1 p.m. |
OK |
GNU C++17 |
TESTS |
30 |
218 |
8396800 |
|
2800 |
50346657 |
llmxby |
F |
Feb. 23, 2019, 6:39 a.m. |
OK |
GNU C++17 |
TESTS |
30 |
233 |
7270400 |
|
2800 |
65034733 |
vjudge3 |
F |
Nov. 15, 2019, 11:14 a.m. |
OK |
GNU C++17 |
TESTS |
30 |
234 |
4812800 |
|
2800 |
52941311 |
Vacantxin_love_null |
F |
April 18, 2019, 9:23 a.m. |
OK |
GNU C++17 |
TESTS |
30 |
234 |
4812800 |
|
2800 |
52267663 |
vjudge3 |
F |
April 3, 2019, 11:59 a.m. |
OK |
GNU C++17 |
TESTS |
30 |
264 |
11980800 |
|
2800 |
57818330 |
Benq |
F |
July 26, 2019, 9:06 p.m. |
OK |
GNU C++17 |
TESTS |
30 |
264 |
12390400 |
|
2800 |
50346089 |
ZhihuiLiu |
F |
Feb. 23, 2019, 6:24 a.m. |
OK |
GNU C++17 |
TESTS |
30 |
265 |
4812800 |
|
2800 |
65797417 |
asd111 |
F |
Nov. 27, 2019, 5:39 a.m. |
OK |
GNU C++17 |
TESTS |
30 |
280 |
12390400 |
|
2800 |
58154419 |
roll_no_1 |
F |
Aug. 2, 2019, 4:47 a.m. |
OK |
GNU C++17 |
TESTS |
30 |
280 |
15974400 |
|
2800 |
58154377 |
vjudge3 |
F |
Aug. 2, 2019, 4:45 a.m. |
OK |
GNU C++17 |
TESTS |
30 |
280 |
15974400 |
|
2800 |
16982521 |
A.Arslan2016 |
F |
March 28, 2016, 4:54 a.m. |
OK |
Java 7 |
TESTS |
30 |
436 |
53862400 |
|
2800 |
16972317 |
uwi |
F |
March 27, 2016, 2:23 p.m. |
OK |
Java 8 |
TESTS |
30 |
436 |
36044800 |
|
2800 |
26948467 |
mmaxio |
F |
May 8, 2017, 1:05 a.m. |
OK |
Java 8 |
TESTS |
30 |
483 |
6348800 |
|
2800 |
23557591 |
hama-du |
F |
Jan. 5, 2017, 3:21 p.m. |
OK |
Java 8 |
TESTS |
30 |
561 |
56729600 |
|
2800 |
16957018 |
og.kostya |
F |
March 26, 2016, 1:38 p.m. |
OK |
MS C# |
TESTS |
30 |
280 |
21708800 |
|
2800 |
64796346 |
vjudge2 |
F |
Nov. 13, 2019, 1:01 p.m. |
OK |
MS C++ |
TESTS |
30 |
265 |
12083200 |
|
2800 |
remove filters
Back to search problems