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"You are given two integers x and k . Grasshopper starts in a point 0 on an OX axis. In one move, it can jump some integer distance, that is not divisible by k , to the left or to the right. What's the smallest number of moves it takes the grasshopper to reach point x ? What are these moves? If there are multiple answers, print any of them. The first line contains a single integer t ( 1 <= t <= 1000 ) -- the number of testcases. The only line of each testcase contains two integers x and k ( 1 <= x <= 100 ; 2 <= k <= 100 ) -- the endpoint and the constraint on the jumps, respectively. For each testcase, in the first line, print a single integer n -- the smallest number of moves it takes the grasshopper to reach point x . In the second line, print n integers, each of them not divisible by k . A positive integer would mean jumping to the right, a negative integer would mean jumping to the left. The endpoint after the jumps should be exactly x . Each jump distance should be from -10^9 to 10^9 . In can be shown that, for any solution with the smallest number of jumps, there exists a solution with the same number of jumps such that each jump is from -10^9 to 10^9 . It can be shown that the answer always exists under the given constraints. If there are multiple answers, print any of them. "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
207267541 |
ansergeyg |
A |
May 25, 2023, 5:12 p.m. |
OK |
C# 10 |
TESTS |
2 |
46 |
102400 |
|
|
207288647 |
bluemegane |
A |
May 25, 2023, 10 p.m. |
OK |
C# 8 |
TESTS |
2 |
61 |
102400 |
|
|
207307416 |
Anupj_mmmut |
A |
May 26, 2023, 5:16 a.m. |
OK |
Clang++17 Diagnostics |
TESTS |
2 |
31 |
0 |
|
|
207284705 |
prime_Rick |
A |
May 25, 2023, 8:34 p.m. |
OK |
Clang++17 Diagnostics |
TESTS |
2 |
46 |
0 |
|
|
207298993 |
vjudge2 |
A |
May 26, 2023, 2:53 a.m. |
OK |
Clang++17 Diagnostics |
TESTS |
2 |
46 |
0 |
|
|
207296218 |
vjudge5 |
A |
May 26, 2023, 1:54 a.m. |
OK |
Clang++17 Diagnostics |
TESTS |
2 |
61 |
0 |
|
|
207267418 |
aloksingh910 |
A |
May 25, 2023, 5:11 p.m. |
OK |
Clang++20 Diagnostics |
TESTS |
2 |
46 |
0 |
|
|
207281902 |
iffatul_anon |
A |
May 25, 2023, 7:48 p.m. |
OK |
GNU C11 |
TESTS |
2 |
0 |
0 |
|
|
207307900 |
ashraf989 |
A |
May 26, 2023, 5:23 a.m. |
OK |
GNU C11 |
TESTS |
2 |
0 |
0 |
|
|
207305630 |
mahmudrashik |
A |
May 26, 2023, 4:50 a.m. |
OK |
GNU C11 |
TESTS |
2 |
15 |
0 |
|
|
207269133 |
MAK_AZ |
A |
May 25, 2023, 5:25 p.m. |
OK |
GNU C11 |
TESTS |
2 |
15 |
0 |
|
|
207274184 |
Renaissance_Eusha |
A |
May 25, 2023, 6:11 p.m. |
OK |
GNU C11 |
TESTS |
2 |
15 |
0 |
|
|
207283925 |
lazy_baymax |
A |
May 25, 2023, 8:20 p.m. |
OK |
GNU C11 |
TESTS |
2 |
15 |
0 |
|
|
207261414 |
saaad |
A |
May 25, 2023, 4:37 p.m. |
OK |
GNU C11 |
TESTS |
2 |
15 |
0 |
|
|
207297616 |
csp2022 |
A |
May 26, 2023, 2:26 a.m. |
OK |
GNU C11 |
TESTS |
2 |
31 |
0 |
|
|
207306948 |
Ywave |
A |
May 26, 2023, 5:09 a.m. |
OK |
GNU C11 |
TESTS |
2 |
31 |
0 |
|
|
207288033 |
dreamtolearn |
A |
May 25, 2023, 9:44 p.m. |
OK |
GNU C11 |
TESTS |
2 |
31 |
0 |
|
|
207309139 |
zzuqy |
A |
May 26, 2023, 5:39 a.m. |
OK |
GNU C++14 |
TESTS |
2 |
0 |
0 |
|
|
207308991 |
_rajan |
A |
May 26, 2023, 5:37 a.m. |
OK |
GNU C++14 |
TESTS |
2 |
0 |
0 |
|
|
207308698 |
Soniya_kindo |
A |
May 26, 2023, 5:34 a.m. |
OK |
GNU C++14 |
TESTS |
2 |
0 |
0 |
|
|
207308212 |
yizhixiaoyun |
A |
May 26, 2023, 5:27 a.m. |
OK |
GNU C++14 |
TESTS |
2 |
0 |
0 |
|
|
207308128 |
Dowry |
A |
May 26, 2023, 5:26 a.m. |
OK |
GNU C++14 |
TESTS |
2 |
0 |
0 |
|
|
207308110 |
yizhixiaoyun |
A |
May 26, 2023, 5:26 a.m. |
OK |
GNU C++14 |
TESTS |
2 |
0 |
0 |
|
|
207307583 |
syz_ |
A |
May 26, 2023, 5:18 a.m. |
OK |
GNU C++14 |
TESTS |
2 |
0 |
0 |
|
|
207306815 |
mandloiji71 |
A |
May 26, 2023, 5:07 a.m. |
OK |
GNU C++14 |
TESTS |
2 |
0 |
0 |
|
|
207310177 |
a_p |
A |
May 26, 2023, 5:53 a.m. |
OK |
GNU C++14 |
TESTS |
2 |
0 |
0 |
|
|
207309527 |
singhpranshu72 |
A |
May 26, 2023, 5:44 a.m. |
OK |
GNU C++14 |
TESTS |
2 |
0 |
0 |
|
|
207308708 |
Guycholo_ |
A |
May 26, 2023, 5:34 a.m. |
OK |
GNU C++17 |
TESTS |
2 |
0 |
0 |
|
|
207308743 |
Alvy |
A |
May 26, 2023, 5:34 a.m. |
OK |
GNU C++17 |
TESTS |
2 |
0 |
0 |
|
|
207308882 |
Hoppz |
A |
May 26, 2023, 5:36 a.m. |
OK |
GNU C++17 |
TESTS |
2 |
0 |
0 |
|
|
207308947 |
MonDellBit |
A |
May 26, 2023, 5:37 a.m. |
OK |
GNU C++17 |
TESTS |
2 |
0 |
0 |
|
|
207309028 |
deepkarm |
A |
May 26, 2023, 5:38 a.m. |
OK |
GNU C++17 |
TESTS |
2 |
0 |
0 |
|
|
207309573 |
MonDellBit |
A |
May 26, 2023, 5:45 a.m. |
OK |
GNU C++17 |
TESTS |
2 |
0 |
0 |
|
|
207310289 |
parth_1818 |
A |
May 26, 2023, 5:54 a.m. |
OK |
GNU C++17 |
TESTS |
2 |
0 |
0 |
|
|
207310912 |
SoiMae |
A |
May 26, 2023, 6:02 a.m. |
OK |
GNU C++17 |
TESTS |
2 |
0 |
0 |
|
|
207308636 |
varun_1008 |
A |
May 26, 2023, 5:33 a.m. |
OK |
GNU C++17 |
TESTS |
2 |
0 |
0 |
|
|
207308046 |
eshtiakhasan |
A |
May 26, 2023, 5:25 a.m. |
OK |
GNU C++17 |
TESTS |
2 |
0 |
0 |
|
|
207308239 |
ujjvalsaini |
A |
May 26, 2023, 5:27 a.m. |
OK |
GNU C++17 (64) |
TESTS |
2 |
0 |
0 |
|
|
207310929 |
ch_beans |
A |
May 26, 2023, 6:02 a.m. |
OK |
GNU C++17 (64) |
TESTS |
2 |
0 |
0 |
|
|
207308640 |
ZzMK |
A |
May 26, 2023, 5:33 a.m. |
OK |
GNU C++17 (64) |
TESTS |
2 |
0 |
0 |
|
|
207308510 |
Njaso |
A |
May 26, 2023, 5:31 a.m. |
OK |
GNU C++17 (64) |
TESTS |
2 |
0 |
0 |
|
|
207306831 |
OMG_wc |
A |
May 26, 2023, 5:07 a.m. |
OK |
GNU C++17 (64) |
TESTS |
2 |
0 |
0 |
|
|
207306829 |
kjhhjki |
A |
May 26, 2023, 5:07 a.m. |
OK |
GNU C++17 (64) |
TESTS |
2 |
0 |
0 |
|
|
207306690 |
itumi |
A |
May 26, 2023, 5:06 a.m. |
OK |
GNU C++17 (64) |
TESTS |
2 |
0 |
0 |
|
|
207306074 |
Sy_03 |
A |
May 26, 2023, 4:56 a.m. |
OK |
GNU C++17 (64) |
TESTS |
2 |
0 |
0 |
|
|
207304216 |
815741912 |
A |
May 26, 2023, 4:27 a.m. |
OK |
GNU C++17 (64) |
TESTS |
2 |
0 |
0 |
|
|
207304086 |
lunchbox |
A |
May 26, 2023, 4:25 a.m. |
OK |
GNU C++17 (64) |
TESTS |
2 |
0 |
0 |
|
|
207308678 |
CP_CDI |
A |
May 26, 2023, 5:33 a.m. |
OK |
GNU C++20 (64) |
TESTS |
2 |
0 |
0 |
|
|
207308729 |
HaMeem08 |
A |
May 26, 2023, 5:34 a.m. |
OK |
GNU C++20 (64) |
TESTS |
2 |
0 |
0 |
|
|
207309721 |
vshal |
A |
May 26, 2023, 5:47 a.m. |
OK |
GNU C++20 (64) |
TESTS |
2 |
0 |
0 |
|
|
207309880 |
AJinGoo |
A |
May 26, 2023, 5:49 a.m. |
OK |
GNU C++20 (64) |
TESTS |
2 |
0 |
0 |
|
|
207309946 |
GeekyPandey817 |
A |
May 26, 2023, 5:50 a.m. |
OK |
GNU C++20 (64) |
TESTS |
2 |
0 |
0 |
|
|
207310053 |
ayush_r01 |
A |
May 26, 2023, 5:51 a.m. |
OK |
GNU C++20 (64) |
TESTS |
2 |
0 |
0 |
|
|
207310300 |
chiragagarwal07052001 |
A |
May 26, 2023, 5:54 a.m. |
OK |
GNU C++20 (64) |
TESTS |
2 |
0 |
0 |
|
|
207310489 |
_brucewayne_ |
A |
May 26, 2023, 5:57 a.m. |
OK |
GNU C++20 (64) |
TESTS |
2 |
0 |
0 |
|
|
207310678 |
observation |
A |
May 26, 2023, 5:59 a.m. |
OK |
GNU C++20 (64) |
TESTS |
2 |
0 |
0 |
|
|
207310768 |
harshdev625 |
A |
May 26, 2023, 6 a.m. |
OK |
GNU C++20 (64) |
TESTS |
2 |
0 |
0 |
|
|
207282880 |
ash_79 |
A |
May 25, 2023, 8:04 p.m. |
OK |
Java 11 |
TESTS |
2 |
170 |
0 |
|
|
207277722 |
InfinitePath |
A |
May 25, 2023, 6:49 p.m. |
OK |
Java 11 |
TESTS |
2 |
171 |
0 |
|
|
207273476 |
sunaj |
A |
May 25, 2023, 6:04 p.m. |
OK |
Java 11 |
TESTS |
2 |
171 |
0 |
|
|
207279274 |
Ayyylmao |
A |
May 25, 2023, 7:09 p.m. |
OK |
Java 11 |
TESTS |
2 |
186 |
0 |
|
|
207307087 |
TJ_Codes |
A |
May 26, 2023, 5:11 a.m. |
OK |
Java 11 |
TESTS |
2 |
186 |
0 |
|
|
207304771 |
SAY_NO_TO_EDITORIAL |
A |
May 26, 2023, 4:36 a.m. |
OK |
Java 11 |
TESTS |
2 |
186 |
0 |
|
|
207298461 |
ilasiawo |
A |
May 26, 2023, 2:42 a.m. |
OK |
Java 11 |
TESTS |
2 |
186 |
0 |
|
|
207299593 |
Un_sung |
A |
May 26, 2023, 3:04 a.m. |
OK |
Java 11 |
TESTS |
2 |
202 |
0 |
|
|
207299413 |
yuziqikk |
A |
May 26, 2023, 3:01 a.m. |
OK |
Java 11 |
TESTS |
2 |
217 |
0 |
|
|
207305107 |
hugewarriors |
A |
May 26, 2023, 4:41 a.m. |
OK |
Java 11 |
TESTS |
2 |
218 |
0 |
|
|
207274717 |
MagentaCobra |
A |
May 25, 2023, 6:16 p.m. |
OK |
Java 17 |
TESTS |
2 |
124 |
102400 |
|
|
207274622 |
Vrutik_2809 |
A |
May 25, 2023, 6:15 p.m. |
OK |
Java 17 |
TESTS |
2 |
155 |
0 |
|
|
207271777 |
Siva_31980 |
A |
May 25, 2023, 5:49 p.m. |
OK |
Java 17 |
TESTS |
2 |
171 |
0 |
|
|
207281494 |
priyanshu.sharma2612 |
A |
May 25, 2023, 7:42 p.m. |
OK |
Java 17 |
TESTS |
2 |
171 |
204800 |
|
|
207297750 |
SakibSibly |
A |
May 26, 2023, 2:28 a.m. |
OK |
Java 17 |
TESTS |
2 |
171 |
716800 |
|
|
207296083 |
bleach__ |
A |
May 26, 2023, 1:50 a.m. |
OK |
Java 17 |
TESTS |
2 |
171 |
5120000 |
|
|
207303306 |
maverick_1729 |
A |
May 26, 2023, 4:11 a.m. |
OK |
Java 17 |
TESTS |
2 |
171 |
41574400 |
|
|
207280932 |
Rachhh_04 |
A |
May 25, 2023, 7:33 p.m. |
OK |
Java 17 |
TESTS |
2 |
186 |
204800 |
|
|
207271658 |
rated21 |
A |
May 25, 2023, 5:48 p.m. |
OK |
Java 17 |
TESTS |
2 |
186 |
204800 |
|
|
207290697 |
Zakaria_Eysa |
A |
May 25, 2023, 11:07 p.m. |
OK |
Java 17 |
TESTS |
2 |
186 |
409600 |
|
|
207295333 |
chuquwan9964 |
A |
May 26, 2023, 1:33 a.m. |
OK |
Java 8 |
TESTS |
2 |
93 |
0 |
|
|
207290395 |
AbdelrahmanFathy |
A |
May 25, 2023, 10:55 p.m. |
OK |
Java 8 |
TESTS |
2 |
93 |
0 |
|
|
207264636 |
ss171 |
A |
May 25, 2023, 4:53 p.m. |
OK |
Java 8 |
TESTS |
2 |
93 |
0 |
|
|
207305246 |
Inferior_Geek |
A |
May 26, 2023, 4:44 a.m. |
OK |
Java 8 |
TESTS |
2 |
108 |
0 |
|
|
207308003 |
Parth_Pandey |
A |
May 26, 2023, 5:24 a.m. |
OK |
Java 8 |
TESTS |
2 |
109 |
0 |
|
|
207266052 |
PoloBanker |
A |
May 25, 2023, 5:02 p.m. |
OK |
Java 8 |
TESTS |
2 |
124 |
0 |
|
|
207264306 |
Juhaied_nabid |
A |
May 25, 2023, 4:52 p.m. |
OK |
Java 8 |
TESTS |
2 |
124 |
0 |
|
|
207263646 |
lpychemistry |
A |
May 25, 2023, 4:48 p.m. |
OK |
Java 8 |
TESTS |
2 |
124 |
0 |
|
|
207263507 |
depurador_ik |
A |
May 25, 2023, 4:47 p.m. |
OK |
Java 8 |
TESTS |
2 |
139 |
38297600 |
|
|
207296610 |
ab411 |
A |
May 26, 2023, 2:03 a.m. |
OK |
Java 8 |
TESTS |
2 |
140 |
0 |
|
|
207308802 |
medooooo5o6 |
A |
May 26, 2023, 5:35 a.m. |
OK |
JavaScript |
TESTS |
2 |
15 |
204800 |
|
|
207261917 |
Krantzy |
A |
May 25, 2023, 4:39 p.m. |
OK |
Kotlin 1.7 |
TESTS |
2 |
265 |
0 |
|
|
207283657 |
Gadi |
A |
May 25, 2023, 8:15 p.m. |
OK |
MS C++ 2017 |
TESTS |
2 |
0 |
0 |
|
|
207283294 |
skimono |
A |
May 25, 2023, 8:10 p.m. |
OK |
MS C++ 2017 |
TESTS |
2 |
0 |
0 |
|
|
207297279 |
SackSia |
A |
May 26, 2023, 2:18 a.m. |
OK |
MS C++ 2017 |
TESTS |
2 |
0 |
20070400 |
|
|
207288822 |
kaurjasleen240305 |
A |
May 25, 2023, 10:05 p.m. |
OK |
MS C++ 2017 |
TESTS |
2 |
15 |
0 |
|
|
207294200 |
xiaotianxiang |
A |
May 26, 2023, 1:05 a.m. |
OK |
MS C++ 2017 |
TESTS |
2 |
30 |
0 |
|
|
207260879 |
knight2995 |
A |
May 25, 2023, 4:34 p.m. |
OK |
PyPy 3 |
TESTS |
2 |
93 |
2969600 |
|
|
207272352 |
Yash_Nandwana |
A |
May 25, 2023, 5:54 p.m. |
OK |
PyPy 3 |
TESTS |
2 |
108 |
4505600 |
|
|
207289607 |
random__person |
A |
May 25, 2023, 10:29 p.m. |
OK |
PyPy 3 |
TESTS |
2 |
124 |
3072000 |
|
|
207265947 |
indian_dumb_cheaters |
A |
May 25, 2023, 5:01 p.m. |
OK |
PyPy 3 |
TESTS |
2 |
139 |
4300800 |
|
|
207261508 |
VidGa |
A |
May 25, 2023, 4:37 p.m. |
OK |
PyPy 3 |
TESTS |
2 |
139 |
4300800 |
|
|
207305053 |
noob_coder121324 |
A |
May 26, 2023, 4:40 a.m. |
OK |
PyPy 3 |
TESTS |
2 |
155 |
3481600 |
|
|
207297098 |
Quick-One |
A |
May 26, 2023, 2:14 a.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
62 |
4915200 |
|
|
207265683 |
Khatarnak_Khandu |
A |
May 25, 2023, 4:59 p.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
77 |
3788800 |
|
|
207280235 |
magde.spb |
A |
May 25, 2023, 7:24 p.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
77 |
4198400 |
|
|
207277860 |
Erekemingoi |
A |
May 25, 2023, 6:50 p.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
77 |
4710400 |
|
|
207291346 |
pennymagic156 |
A |
May 25, 2023, 11:33 p.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
77 |
4812800 |
|
|
207264187 |
I_Am_That |
A |
May 25, 2023, 4:51 p.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
77 |
4812800 |
|
|
207302951 |
Hisoka-TheMagician |
A |
May 26, 2023, 4:05 a.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
77 |
4915200 |
|
|
207279156 |
isPritchin |
A |
May 25, 2023, 7:07 p.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
93 |
3584000 |
|
|
207270253 |
alexwice |
A |
May 25, 2023, 5:35 p.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
93 |
4096000 |
|
|
207268436 |
ankitesh |
A |
May 25, 2023, 5:19 p.m. |
OK |
PyPy 3-64 |
TESTS |
2 |
93 |
4505600 |
|
|
207281288 |
Traverser_25 |
A |
May 25, 2023, 7:39 p.m. |
OK |
Python 3 |
TESTS |
2 |
15 |
0 |
|
|
207274320 |
nvllable |
A |
May 25, 2023, 6:13 p.m. |
OK |
Python 3 |
TESTS |
2 |
15 |
0 |
|
|
207300970 |
bubbotee |
A |
May 26, 2023, 3:26 a.m. |
OK |
Python 3 |
TESTS |
2 |
30 |
0 |
|
|
207275467 |
_rahul11_ |
A |
May 25, 2023, 6:24 p.m. |
OK |
Python 3 |
TESTS |
2 |
30 |
0 |
|
|
207275105 |
Kigu |
A |
May 25, 2023, 6:20 p.m. |
OK |
Python 3 |
TESTS |
2 |
30 |
0 |
|
|
207265809 |
prateekb1729 |
A |
May 25, 2023, 5 p.m. |
OK |
Python 3 |
TESTS |
2 |
30 |
0 |
|
|
207261215 |
hxyz |
A |
May 25, 2023, 4:37 p.m. |
OK |
Python 3 |
TESTS |
2 |
30 |
0 |
|
|
207286753 |
momenelmesady4803 |
A |
May 25, 2023, 9:13 p.m. |
OK |
Python 3 |
TESTS |
2 |
30 |
102400 |
|
|
207307492 |
nitin2203 |
A |
May 26, 2023, 5:17 a.m. |
OK |
Python 3 |
TESTS |
2 |
31 |
0 |
|
|
207298706 |
zhong_father |
A |
May 26, 2023, 2:47 a.m. |
OK |
Python 3 |
TESTS |
2 |
31 |
0 |
|
|
207305556 |
M4H1D |
A |
May 26, 2023, 4:49 a.m. |
OK |
Ruby 3 |
TESTS |
2 |
202 |
102400 |
|
|
207288199 |
dmenezes |
A |
May 25, 2023, 9:48 p.m. |
OK |
Rust 2021 |
TESTS |
2 |
0 |
0 |
|
|
207291595 |
Spheniscine |
A |
May 25, 2023, 11:43 p.m. |
OK |
Rust 2021 |
TESTS |
2 |
0 |
102400 |
|
|
207276625 |
matheusdacach |
A |
May 25, 2023, 6:36 p.m. |
OK |
Rust 2021 |
TESTS |
2 |
0 |
102400 |
|
|
207288039 |
dmenezes |
A |
May 25, 2023, 9:44 p.m. |
OK |
Rust 2021 |
TESTS |
2 |
0 |
307200 |
|
|
207283744 |
kost |
A |
May 25, 2023, 8:17 p.m. |
OK |
Rust 2021 |
TESTS |
2 |
30 |
0 |
|
|
remove filters
Back to search problems