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"Stepan has a very big positive integer. Let's consider all cyclic shifts of Stepan's integer (if we look at his integer like at a string) which are also integers (i.e. they do not have leading zeros). Let's call such shifts as good shifts. For example, for the integer 10203 the good shifts are the integer itself 10203 and integers 20310 and 31020. Stepan wants to know the minimum remainder of the division by the given number m among all good shifts. Your task is to determine the minimum remainder of the division by m. The first line contains the integer which Stepan has. The length of Stepan's integer is between 2 and 200 xe2 x80 x89000 digits, inclusive. It is guaranteed that Stepan's integer does not contain leading zeros. The second line contains the integer m (2 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89m xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89108) -- the number by which Stepan divides good shifts of his integer. Print the minimum remainder which Stepan can get if he divides all good shifts of his integer by the given number m. In the first example all good shifts of the integer 521 (good shifts are equal to 521, 215 and 152) has same remainder 2 when dividing by 3. In the second example there are only two good shifts: the Stepan's integer itself and the shift by one position to the right. The integer itself is 1001 and the remainder after dividing it by 5 equals 1. The shift by one position to the right equals to 1100 and the remainder after dividing it by 5 equals 0, which is the minimum possible remainder. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
35896932 |
Faster |
E |
March 3, 2018, 5:39 p.m. |
OK |
D |
TESTS |
62 |
234 |
7168000 |
|
2400 |
35896912 |
Faster |
E |
March 3, 2018, 5:38 p.m. |
OK |
D |
TESTS |
62 |
249 |
7168000 |
|
2400 |
40982263 |
ReaLNero1 |
E |
July 30, 2018, 6:20 p.m. |
OK |
FPC |
TESTS |
62 |
46 |
2969600 |
|
2400 |
26184288 |
Bekmyrat.A |
E |
April 7, 2017, 5:08 a.m. |
OK |
GNU C |
TESTS |
62 |
31 |
6860800 |
|
2400 |
26465751 |
X_rotator |
E |
April 17, 2017, 11:44 p.m. |
OK |
GNU C++ |
TESTS |
62 |
31 |
2048000 |
|
2400 |
29840573 |
mualanhlung017 |
E |
Aug. 28, 2017, 7:45 a.m. |
OK |
GNU C++ |
TESTS |
62 |
31 |
2150400 |
|
2400 |
30223949 |
bhaag_milkha |
E |
Sept. 9, 2017, 11:16 a.m. |
OK |
GNU C++ |
TESTS |
62 |
46 |
2867200 |
|
2400 |
26392927 |
hmmmm_1 |
E |
April 15, 2017, 4:25 p.m. |
OK |
GNU C++ |
TESTS |
62 |
62 |
2252800 |
|
2400 |
64914697 |
Binary_Search_Tree |
E |
Nov. 15, 2019, 3:09 a.m. |
OK |
GNU C11 |
TESTS |
62 |
31 |
512000 |
|
2400 |
64914790 |
Binary_Search_Tree |
E |
Nov. 15, 2019, 3:12 a.m. |
OK |
GNU C11 |
TESTS |
62 |
31 |
512000 |
|
2400 |
64910327 |
gsyz |
E |
Nov. 15, 2019, 2:41 a.m. |
OK |
GNU C11 |
TESTS |
62 |
46 |
1024000 |
|
2400 |
30495343 |
wfj_2048 |
E |
Sept. 19, 2017, 11:31 a.m. |
OK |
GNU C++11 |
TESTS |
62 |
30 |
6553600 |
|
2400 |
27623715 |
Boson |
E |
June 7, 2017, 1:36 a.m. |
OK |
GNU C++11 |
TESTS |
62 |
31 |
204800 |
|
2400 |
27623729 |
rareone0602 |
E |
June 7, 2017, 1:38 a.m. |
OK |
GNU C++11 |
TESTS |
62 |
31 |
204800 |
|
2400 |
57788317 |
bojverdict1 |
E |
July 26, 2019, 8:35 a.m. |
OK |
GNU C++11 |
TESTS |
62 |
31 |
204800 |
|
2400 |
57782617 |
bojverdict1 |
E |
July 26, 2019, 6:34 a.m. |
OK |
GNU C++11 |
TESTS |
62 |
31 |
5017600 |
|
2400 |
57794782 |
1027886893 |
E |
July 26, 2019, 10:59 a.m. |
OK |
GNU C++11 |
TESTS |
62 |
46 |
0 |
|
2400 |
57782280 |
bojverdict1 |
E |
July 26, 2019, 6:26 a.m. |
OK |
GNU C++11 |
TESTS |
62 |
46 |
512000 |
|
2400 |
57806287 |
bojverdict1 |
E |
July 26, 2019, 3:18 p.m. |
OK |
GNU C++11 |
TESTS |
62 |
46 |
2048000 |
|
2400 |
57788454 |
bojverdict2 |
E |
July 26, 2019, 8:38 a.m. |
OK |
GNU C++11 |
TESTS |
62 |
46 |
2048000 |
|
2400 |
57783159 |
bojverdict2 |
E |
July 26, 2019, 6:46 a.m. |
OK |
GNU C++11 |
TESTS |
62 |
46 |
2662400 |
|
2400 |
31529479 |
Kyle_Chi |
E |
Oct. 20, 2017, 10:26 a.m. |
OK |
GNU C++14 |
TESTS |
62 |
30 |
8601600 |
|
2400 |
57788197 |
wayen |
E |
July 26, 2019, 8:33 a.m. |
OK |
GNU C++14 |
TESTS |
62 |
31 |
204800 |
|
2400 |
57788269 |
wayen |
E |
July 26, 2019, 8:34 a.m. |
OK |
GNU C++14 |
TESTS |
62 |
31 |
204800 |
|
2400 |
57798850 |
bojverdict2 |
E |
July 26, 2019, 12:29 p.m. |
OK |
GNU C++14 |
TESTS |
62 |
31 |
512000 |
|
2400 |
57785457 |
bojverdict2 |
E |
July 26, 2019, 7:36 a.m. |
OK |
GNU C++14 |
TESTS |
62 |
31 |
2150400 |
|
2400 |
26289426 |
itsjustwinds2k |
E |
April 11, 2017, 4:18 a.m. |
OK |
GNU C++14 |
TESTS |
62 |
31 |
2150400 |
|
2400 |
26174679 |
zhabo |
E |
April 6, 2017, 4:18 p.m. |
OK |
GNU C++14 |
TESTS |
62 |
31 |
6963200 |
|
2400 |
57782446 |
bojverdict1 |
E |
July 26, 2019, 6:30 a.m. |
OK |
GNU C++14 |
TESTS |
62 |
31 |
9011200 |
|
2400 |
57794828 |
bojverdict1 |
E |
July 26, 2019, 11 a.m. |
OK |
GNU C++14 |
TESTS |
62 |
46 |
204800 |
|
2400 |
57801945 |
bojverdict2 |
E |
July 26, 2019, 1:37 p.m. |
OK |
GNU C++14 |
TESTS |
62 |
46 |
204800 |
|
2400 |
43295010 |
smartnj |
E |
Sept. 23, 2018, 12:58 p.m. |
OK |
GNU C++17 |
TESTS |
62 |
46 |
819200 |
|
2400 |
49495249 |
chinmay0906 |
E |
Feb. 5, 2019, 12:30 p.m. |
OK |
GNU C++17 |
TESTS |
62 |
46 |
3993600 |
|
2400 |
48510875 |
Iplayer |
E |
Jan. 17, 2019, 9 p.m. |
OK |
GNU C++17 |
TESTS |
62 |
62 |
2355200 |
|
2400 |
57785787 |
bojverdict1 |
E |
July 26, 2019, 7:43 a.m. |
OK |
GNU C++17 |
TESTS |
62 |
78 |
409600 |
|
2400 |
57790093 |
circless |
E |
July 26, 2019, 9:08 a.m. |
OK |
GNU C++17 |
TESTS |
62 |
139 |
2048000 |
|
2400 |
57785079 |
bojverdict2 |
E |
July 26, 2019, 7:28 a.m. |
OK |
GNU C++17 |
TESTS |
62 |
186 |
66969600 |
|
2400 |
26277944 |
6eJIa9IzZzTeHb |
E |
April 10, 2017, 6:06 p.m. |
OK |
Go |
TESTS |
62 |
436 |
40857600 |
|
2400 |
26153150 |
BruteMaster |
E |
April 5, 2017, 5:02 p.m. |
OK |
Java 8 |
TESTS |
62 |
124 |
20582400 |
|
2400 |
41959330 |
hongquanntct |
E |
Aug. 22, 2018, 8:31 a.m. |
OK |
Java 8 |
TESTS |
62 |
140 |
0 |
|
2400 |
26361125 |
krijgertje |
E |
April 14, 2017, 3:40 p.m. |
OK |
Java 8 |
TESTS |
62 |
156 |
20992000 |
|
2400 |
26174696 |
MazzForces |
E |
April 6, 2017, 4:18 p.m. |
OK |
Java 8 |
TESTS |
62 |
202 |
20684800 |
|
2400 |
26232701 |
_ShadowSong |
E |
April 9, 2017, 8:29 a.m. |
OK |
Kotlin |
TESTS |
62 |
140 |
20787200 |
|
2400 |
54620115 |
Nick_Brain |
E |
May 25, 2019, 11:53 a.m. |
OK |
Mono C# |
TESTS |
62 |
62 |
716800 |
|
2400 |
50497197 |
CoffeeDog |
E |
Feb. 25, 2019, 3:39 p.m. |
OK |
PyPy 3 |
TESTS |
62 |
155 |
5734400 |
|
2400 |
26154908 |
Starcall Xrite |
E |
April 5, 2017, 5:28 p.m. |
OK |
PyPy 3 |
TESTS |
62 |
156 |
26726400 |
|
2400 |
58635709 |
linhthi |
E |
Aug. 12, 2019, 12:03 a.m. |
OK |
PyPy 3 |
TESTS |
62 |
1263 |
9830400 |
|
2400 |
28184055 |
BenL |
E |
July 1, 2017, 4:48 a.m. |
OK |
PyPy 3 |
TESTS |
62 |
1794 |
30310400 |
|
2400 |
28303405 |
std11 |
E |
July 5, 2017, 12:12 p.m. |
OK |
Python 2 |
TESTS |
62 |
1622 |
9113600 |
|
2400 |
26150204 |
StarScreamOwl ednotdead |
E |
April 5, 2017, 4:23 p.m. |
OK |
Python 3 |
TESTS |
62 |
701 |
6348800 |
|
2400 |
28184062 |
BenL |
E |
July 1, 2017, 4:49 a.m. |
OK |
Python 3 |
TESTS |
62 |
1434 |
6348800 |
|
2400 |
57914652 |
lopare |
E |
July 29, 2019, 12:04 a.m. |
OK |
Python 3 |
TESTS |
62 |
2277 |
819200 |
|
2400 |
26153134 |
mihaiI Djok216 |
E |
April 5, 2017, 5:01 p.m. |
OK |
Rust |
TESTS |
62 |
31 |
2150400 |
|
2400 |
26185828 |
haleyk100198 |
E |
April 7, 2017, 7:11 a.m. |
OK |
Scala |
TESTS |
62 |
280 |
23552000 |
|
2400 |
remove filters
Back to search problems