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'Mike has a frog and a flower. His frog is named Xaniar and his flower is named Abol. Initially(at time 0), height of Xaniar is h1 and height of Abol is h2. Each second, Mike waters Abol and Xaniar. So, if height of Xaniar is h1 and height of Abol is h2, after one second height of Xaniar will become and height of Abol will become where x1, xe2 x80 x89y1, xe2 x80 x89x2 and y2 are some integer numbers and denotes the remainder of a modulo b. Mike is a competitive programmer fan. He wants to know the minimum time it takes until height of Xania is a1 and height of Abol is a2. Mike has asked you for your help. Calculate the minimum time or say it will never happen. The first line of input contains integer m (2 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89m xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89106). The second line of input contains integers h1 and a1 (0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89h1, xe2 x80 x89a1 xe2 x80 x89< xe2 x80 x89m). The third line of input contains integers x1 and y1 (0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89x1, xe2 x80 x89y1 xe2 x80 x89< xe2 x80 x89m). The fourth line of input contains integers h2 and a2 (0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89h2, xe2 x80 x89a2 xe2 x80 x89< xe2 x80 x89m). The fifth line of input contains integers x2 and y2 (0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89x2, xe2 x80 x89y2 xe2 x80 x89< xe2 x80 x89m). It is guaranteed that h1 xe2 x80 x89 xe2 x89 xa0 xe2 x80 x89a1 and h2 xe2 x80 x89 xe2 x89 xa0 xe2 x80 x89a2. Print the minimum number of seconds until Xaniar reaches height a1 and Abol reaches height a2 or print -1 otherwise. In the first sample, heights sequences are following: Xaniar: Abol: '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
11566314 |
cpy |
A |
June 13, 2015, 10:12 a.m. |
OK |
D |
TESTS |
75 |
171 |
3174400 |
|
1900 |
11306250 |
TheHedgehog |
A |
May 26, 2015, 7:06 p.m. |
OK |
Delphi |
TESTS |
75 |
748 |
48742400 |
|
1900 |
13617552 |
SilverDH |
A |
Oct. 15, 2015, 9:06 a.m. |
OK |
FPC |
TESTS |
75 |
218 |
8192000 |
|
1900 |
11311733 |
ruban |
A |
May 27, 2015, 2:42 a.m. |
OK |
FPC |
TESTS |
75 |
218 |
163532800 |
|
1900 |
11386740 |
Prostotal |
A |
June 2, 2015, 7:19 a.m. |
OK |
FPC |
TESTS |
75 |
249 |
32153600 |
|
1900 |
11324099 |
i_love_gold_and_nt |
A |
May 27, 2015, 6:11 p.m. |
OK |
FPC |
TESTS |
75 |
249 |
32153600 |
|
1900 |
31412861 |
dthung1602 |
A |
Oct. 16, 2017, 1:17 p.m. |
OK |
GNU C |
TESTS |
75 |
46 |
2867200 |
|
1900 |
11305917 |
zeosutt |
A |
May 26, 2015, 7:02 p.m. |
OK |
GNU C |
TESTS |
75 |
77 |
3993600 |
|
1900 |
12118162 |
sanketM |
A |
July 19, 2015, 3:34 p.m. |
OK |
GNU C |
TESTS |
75 |
78 |
0 |
|
1900 |
11368390 |
deathcoder123 |
A |
May 31, 2015, 3:17 p.m. |
OK |
GNU C |
TESTS |
75 |
78 |
0 |
|
1900 |
11354980 |
Sunshine_tcf |
A |
May 30, 2015, 9:22 a.m. |
OK |
GNU C |
TESTS |
75 |
78 |
0 |
|
1900 |
11301804 |
Chipe1 |
A |
May 26, 2015, 6:20 p.m. |
OK |
GNU C |
TESTS |
75 |
78 |
1024000 |
|
1900 |
17478751 |
hardiknegi |
A |
April 24, 2016, 10:48 a.m. |
OK |
GNU C |
TESTS |
75 |
78 |
2048000 |
|
1900 |
11354949 |
vjudge1 |
A |
May 30, 2015, 9:19 a.m. |
OK |
GNU C |
TESTS |
75 |
93 |
0 |
|
1900 |
12603499 |
Who1 |
A |
Aug. 19, 2015, 1:12 p.m. |
OK |
GNU C |
TESTS |
75 |
109 |
16076800 |
|
1900 |
13866567 |
y0rkl1u |
A |
Oct. 26, 2015, 5:30 a.m. |
OK |
GNU C++ |
TESTS |
75 |
46 |
0 |
|
1900 |
15425245 |
Recoder |
A |
Jan. 18, 2016, 10:17 a.m. |
OK |
GNU C++ |
TESTS |
75 |
46 |
0 |
|
1900 |
13875324 |
3901130101 |
A |
Oct. 26, 2015, 3:48 p.m. |
OK |
GNU C++ |
TESTS |
75 |
46 |
0 |
|
1900 |
13875287 |
3901130101 |
A |
Oct. 26, 2015, 3:46 p.m. |
OK |
GNU C++ |
TESTS |
75 |
46 |
0 |
|
1900 |
40986596 |
ReaLNero1 |
A |
July 30, 2018, 8:38 p.m. |
OK |
GNU C++ |
TESTS |
75 |
46 |
2048000 |
|
1900 |
11306960 |
thequickfox |
A |
May 26, 2015, 7:15 p.m. |
OK |
GNU C++ |
TESTS |
75 |
46 |
2048000 |
|
1900 |
11334784 |
asdsteven2 |
A |
May 28, 2015, 3:03 p.m. |
OK |
GNU C++ |
TESTS |
75 |
46 |
3788800 |
|
1900 |
11719861 |
TimeMachine |
A |
June 23, 2015, 9 a.m. |
OK |
GNU C++ |
TESTS |
75 |
46 |
7782400 |
|
1900 |
17523932 |
vjudge1 |
A |
April 26, 2016, 3:20 p.m. |
OK |
GNU C++ |
TESTS |
75 |
46 |
10035200 |
|
1900 |
11311201 |
dojiboy9 |
A |
May 27, 2015, 1:29 a.m. |
OK |
GNU C++ |
TESTS |
75 |
61 |
3993600 |
|
1900 |
57297872 |
rainboy |
A |
July 18, 2019, 8:30 p.m. |
OK |
GNU C11 |
TESTS |
75 |
46 |
3993600 |
|
1900 |
14849580 |
tantan132 |
A |
Dec. 17, 2015, 5:57 p.m. |
OK |
GNU C++11 |
TESTS |
75 |
46 |
0 |
|
1900 |
28836387 |
Fresh_air |
A |
July 24, 2017, 3:08 p.m. |
OK |
GNU C++11 |
TESTS |
75 |
46 |
2150400 |
|
1900 |
28744319 |
vjudge5 |
A |
July 21, 2017, 8:15 a.m. |
OK |
GNU C++11 |
TESTS |
75 |
46 |
2867200 |
|
1900 |
28167374 |
RNS_KSB |
A |
June 30, 2017, 8:21 a.m. |
OK |
GNU C++11 |
TESTS |
75 |
46 |
3072000 |
|
1900 |
11409368 |
fqw |
A |
June 4, 2015, 5:05 a.m. |
OK |
GNU C++11 |
TESTS |
75 |
46 |
3993600 |
|
1900 |
14199540 |
oml1111 |
A |
Nov. 11, 2015, 5:11 p.m. |
OK |
GNU C++11 |
TESTS |
75 |
46 |
3993600 |
|
1900 |
13675924 |
ragnarr |
A |
Oct. 17, 2015, 7:03 a.m. |
OK |
GNU C++11 |
TESTS |
75 |
46 |
3993600 |
|
1900 |
11305922 |
slycelote |
A |
May 26, 2015, 7:02 p.m. |
OK |
GNU C++11 |
TESTS |
75 |
46 |
3993600 |
|
1900 |
18352695 |
chitanda |
A |
June 10, 2016, 5:55 a.m. |
OK |
GNU C++11 |
TESTS |
75 |
46 |
6246400 |
|
1900 |
27439814 |
sigkill-uw |
A |
May 30, 2017, 4:32 a.m. |
OK |
GNU C++11 |
TESTS |
75 |
46 |
7782400 |
|
1900 |
48108976 |
Zenkai |
A |
Jan. 9, 2019, 7:54 a.m. |
OK |
GNU C++14 |
TESTS |
75 |
46 |
1638400 |
|
1900 |
58926054 |
thebes |
A |
Aug. 16, 2019, 7:34 p.m. |
OK |
GNU C++14 |
TESTS |
75 |
46 |
3993600 |
|
1900 |
62173700 |
Gabriel98 |
A |
Oct. 9, 2019, 2:42 a.m. |
OK |
GNU C++14 |
TESTS |
75 |
46 |
7987200 |
|
1900 |
28792001 |
vjudge5 |
A |
July 23, 2017, 5:12 a.m. |
OK |
GNU C++14 |
TESTS |
75 |
46 |
9932800 |
|
1900 |
40632735 |
Patiala_Peg |
A |
July 22, 2018, 10:19 a.m. |
OK |
GNU C++14 |
TESTS |
75 |
46 |
30105600 |
|
1900 |
27369954 |
BatyrAkhmetov |
A |
May 27, 2017, 8:31 a.m. |
OK |
GNU C++14 |
TESTS |
75 |
61 |
0 |
|
1900 |
35887122 |
______n______ |
A |
March 3, 2018, 1:58 p.m. |
OK |
GNU C++14 |
TESTS |
75 |
61 |
1945600 |
|
1900 |
35874965 |
______h______ |
A |
March 3, 2018, 8:03 a.m. |
OK |
GNU C++14 |
TESTS |
75 |
61 |
1945600 |
|
1900 |
35885844 |
_____i_____ |
A |
March 3, 2018, 1:37 p.m. |
OK |
GNU C++14 |
TESTS |
75 |
61 |
1945600 |
|
1900 |
35886246 |
_____k_____ |
A |
March 3, 2018, 1:43 p.m. |
OK |
GNU C++14 |
TESTS |
75 |
61 |
1945600 |
|
1900 |
61220296 |
nickluo |
A |
Sept. 24, 2019, 1:46 p.m. |
OK |
GNU C++17 |
TESTS |
75 |
46 |
4505600 |
|
1900 |
38563278 |
alidadar7676 |
A |
May 23, 2018, 1:30 p.m. |
OK |
GNU C++17 |
TESTS |
75 |
62 |
0 |
|
1900 |
64865592 |
ruo |
A |
Nov. 14, 2019, 6:03 a.m. |
OK |
GNU C++17 |
TESTS |
75 |
62 |
1024000 |
|
1900 |
61220182 |
nickluo |
A |
Sept. 24, 2019, 1:44 p.m. |
OK |
GNU C++17 |
TESTS |
75 |
62 |
4505600 |
|
1900 |
51905680 |
Nakagawa.Kanon |
A |
March 27, 2019, 3:24 p.m. |
OK |
GNU C++17 |
TESTS |
75 |
62 |
21401600 |
|
1900 |
54369244 |
Peter.Park |
A |
May 19, 2019, 5:37 a.m. |
OK |
GNU C++17 |
TESTS |
75 |
62 |
25292800 |
|
1900 |
46832325 |
RUSH_D_CAT |
A |
Dec. 9, 2018, 10:52 p.m. |
OK |
GNU C++17 |
TESTS |
75 |
62 |
170291200 |
|
1900 |
57102776 |
mlyean |
A |
July 15, 2019, 2:20 p.m. |
OK |
GNU C++17 |
TESTS |
75 |
77 |
0 |
|
1900 |
39807456 |
mirsaid_mir |
A |
June 30, 2018, 9:02 p.m. |
OK |
GNU C++17 |
TESTS |
75 |
77 |
0 |
|
1900 |
56990876 |
FlowerOfSorrow |
A |
July 13, 2019, 6:12 p.m. |
OK |
GNU C++17 |
TESTS |
75 |
77 |
0 |
|
1900 |
11315366 |
vjudge3 |
A |
May 27, 2015, 7:59 a.m. |
OK |
Haskell |
TESTS |
75 |
951 |
7577600 |
|
1900 |
11315390 |
CyberZHG |
A |
May 27, 2015, 8:01 a.m. |
OK |
Haskell |
TESTS |
75 |
966 |
7577600 |
|
1900 |
11307829 |
Solve4Fun |
A |
May 26, 2015, 7:34 p.m. |
OK |
Java 7 |
TESTS |
75 |
140 |
0 |
|
1900 |
11336964 |
MatFack |
A |
May 28, 2015, 6:17 p.m. |
OK |
Java 7 |
TESTS |
75 |
140 |
0 |
|
1900 |
11307946 |
Solve4Fun |
A |
May 26, 2015, 7:37 p.m. |
OK |
Java 7 |
TESTS |
75 |
140 |
0 |
|
1900 |
11307849 |
Solve4Fun |
A |
May 26, 2015, 7:35 p.m. |
OK |
Java 7 |
TESTS |
75 |
155 |
0 |
|
1900 |
12007084 |
ale64bit |
A |
July 11, 2015, 10:45 a.m. |
OK |
Java 7 |
TESTS |
75 |
155 |
0 |
|
1900 |
11361696 |
ltjmao |
A |
May 31, 2015, 12:32 a.m. |
OK |
Java 7 |
TESTS |
75 |
155 |
0 |
|
1900 |
11337251 |
MatFack |
A |
May 28, 2015, 6:43 p.m. |
OK |
Java 7 |
TESTS |
75 |
155 |
0 |
|
1900 |
11283792 |
uwi |
A |
May 26, 2015, 4:51 p.m. |
OK |
Java 7 |
TESTS |
75 |
155 |
0 |
|
1900 |
11322309 |
Phicar |
A |
May 27, 2015, 3:54 p.m. |
OK |
Java 7 |
TESTS |
75 |
156 |
0 |
|
1900 |
11309634 |
dev_il |
A |
May 26, 2015, 9:08 p.m. |
OK |
Java 7 |
TESTS |
75 |
156 |
0 |
|
1900 |
49608041 |
KulikAlex |
A |
Feb. 7, 2019, 8:51 p.m. |
OK |
Java 8 |
TESTS |
75 |
155 |
2457600 |
|
1900 |
11322032 |
Slamur |
A |
May 27, 2015, 3:32 p.m. |
OK |
Java 8 |
TESTS |
75 |
171 |
0 |
|
1900 |
57297873 |
Dukkha |
A |
July 18, 2019, 8:30 p.m. |
OK |
Java 8 |
TESTS |
75 |
171 |
0 |
|
1900 |
11284462 |
sweiss |
A |
May 26, 2015, 4:53 p.m. |
OK |
Java 8 |
TESTS |
75 |
171 |
22630400 |
|
1900 |
32244089 |
Kammola |
A |
Nov. 12, 2017, 1:02 p.m. |
OK |
Java 8 |
TESTS |
75 |
186 |
2764800 |
|
1900 |
11633682 |
searcher774 |
A |
June 18, 2015, 2 p.m. |
OK |
Java 8 |
TESTS |
75 |
186 |
10854400 |
|
1900 |
11317114 |
fnch |
A |
May 27, 2015, 10:10 a.m. |
OK |
Java 8 |
TESTS |
75 |
186 |
14643200 |
|
1900 |
11320173 |
serejkee |
A |
May 27, 2015, 1:26 p.m. |
OK |
Java 8 |
TESTS |
75 |
187 |
0 |
|
1900 |
11319194 |
1e9 |
A |
May 27, 2015, 12:26 p.m. |
OK |
Java 8 |
TESTS |
75 |
187 |
0 |
|
1900 |
11318437 |
Tifuera |
A |
May 27, 2015, 11:39 a.m. |
OK |
Java 8 |
TESTS |
75 |
187 |
0 |
|
1900 |
11363595 |
ccbcqbz |
A |
May 31, 2015, 6:55 a.m. |
OK |
Mono C# |
TESTS |
75 |
124 |
2048000 |
|
1900 |
11317341 |
AnatolyTolstobrov |
A |
May 27, 2015, 10:27 a.m. |
OK |
MS C# |
TESTS |
75 |
124 |
409600 |
|
1900 |
11535433 |
sundown |
A |
June 11, 2015, 4:05 p.m. |
OK |
MS C# |
TESTS |
75 |
140 |
512000 |
|
1900 |
11305249 |
azukun |
A |
May 26, 2015, 6:55 p.m. |
OK |
MS C# |
TESTS |
75 |
155 |
2457600 |
|
1900 |
11298134 |
AnatolyTolstobrov |
A |
May 26, 2015, 6 p.m. |
OK |
MS C# |
TESTS |
75 |
202 |
614400 |
|
1900 |
11306722 |
og.kostya |
A |
May 26, 2015, 7:12 p.m. |
OK |
MS C# |
TESTS |
75 |
498 |
307200 |
|
1900 |
11346448 |
superlc320 |
A |
May 29, 2015, 1:50 p.m. |
OK |
MS C++ |
TESTS |
75 |
62 |
0 |
|
1900 |
11286431 |
dotorya |
A |
May 26, 2015, 5:02 p.m. |
OK |
MS C++ |
TESTS |
75 |
62 |
3993600 |
|
1900 |
11386169 |
sister_what_hate_most |
A |
June 2, 2015, 6:02 a.m. |
OK |
MS C++ |
TESTS |
75 |
62 |
3993600 |
|
1900 |
11308856 |
Phoenix_yu |
A |
May 26, 2015, 8:12 p.m. |
OK |
MS C++ |
TESTS |
75 |
62 |
7987200 |
|
1900 |
11313365 |
ashkan_d13 |
A |
May 27, 2015, 5:31 a.m. |
OK |
MS C++ |
TESTS |
75 |
77 |
1024000 |
|
1900 |
11313269 |
ashkan_d13 |
A |
May 27, 2015, 5:24 a.m. |
OK |
MS C++ |
TESTS |
75 |
77 |
1024000 |
|
1900 |
11402901 |
chemthan |
A |
June 3, 2015, 2:25 p.m. |
OK |
MS C++ |
TESTS |
75 |
78 |
0 |
|
1900 |
12404213 |
graciocode |
A |
Aug. 7, 2015, 3:14 p.m. |
OK |
MS C++ |
TESTS |
75 |
78 |
0 |
|
1900 |
12021600 |
FISHTOBY |
A |
July 12, 2015, 5:28 p.m. |
OK |
MS C++ |
TESTS |
75 |
78 |
0 |
|
1900 |
11387680 |
iblacksun |
A |
June 2, 2015, 9:07 a.m. |
OK |
MS C++ |
TESTS |
75 |
78 |
0 |
|
1900 |
11324155 |
gnomnain |
A |
May 27, 2015, 6:15 p.m. |
OK |
Ocaml |
TESTS |
75 |
405 |
204800 |
|
1900 |
18690468 |
m7mdbadawy |
A |
June 23, 2016, 10:55 p.m. |
OK |
PyPy 2 |
TESTS |
75 |
732 |
12288000 |
|
1900 |
31569042 |
yugle7 |
A |
Oct. 21, 2017, 11:22 a.m. |
OK |
PyPy 3 |
TESTS |
75 |
483 |
39936000 |
|
1900 |
11307662 |
rpy3cpp |
A |
May 26, 2015, 7:30 p.m. |
OK |
PyPy 3 |
TESTS |
75 |
498 |
24985600 |
|
1900 |
15559289 |
orailly |
A |
Jan. 24, 2016, 4:09 p.m. |
OK |
PyPy 3 |
TESTS |
75 |
514 |
819200 |
|
1900 |
11338902 |
Ringod |
A |
May 28, 2015, 9:13 p.m. |
OK |
PyPy 3 |
TESTS |
75 |
560 |
1331200 |
|
1900 |
31570985 |
yugle7 |
A |
Oct. 21, 2017, 11:56 a.m. |
OK |
PyPy 3 |
TESTS |
75 |
561 |
24780800 |
|
1900 |
18953508 |
ch_egor |
A |
July 7, 2016, 2:39 p.m. |
OK |
PyPy 3 |
TESTS |
75 |
592 |
1331200 |
|
1900 |
12332244 |
__pikachu__ |
A |
Aug. 4, 2015, 2:17 a.m. |
OK |
PyPy 3 |
TESTS |
75 |
748 |
17612800 |
|
1900 |
12532584 |
nwi |
A |
Aug. 14, 2015, 3:32 p.m. |
OK |
Python 2 |
TESTS |
75 |
982 |
32563200 |
|
1900 |
12027503 |
hellcoder |
A |
July 13, 2015, 9:35 a.m. |
OK |
Scala |
TESTS |
75 |
810 |
921600 |
|
1900 |
11319627 |
limed |
A |
May 27, 2015, 12:54 p.m. |
OK |
Scala |
TESTS |
75 |
811 |
921600 |
|
1900 |
12027530 |
hellcoder |
A |
July 13, 2015, 9:37 a.m. |
OK |
Scala |
TESTS |
75 |
826 |
921600 |
|
1900 |
remove filters
Back to search problems