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 a and b . In one move, you can choose some integer k from 1 to 10 and add it to a or subtract it from a . In other words, you choose an integer k in [1; 10] and perform a := a + k or a := a - k . You may use different values of k in different moves. Your task is to find the minimum number of moves required to obtain b from a . You have to answer t independent test cases. The first line of the input contains one integer t ( 1 <= t <= 2 cdot 10^4 ) -- the number of test cases. Then t test cases follow. The only line of the test case contains two integers a and b ( 1 <= a, b <= 10^9 ). For each test case, print the answer: the minimum number of moves required to obtain b from a . In the first test case of the example, you don't need to do anything. In the second test case of the example, the following sequence of moves can be applied: 13 rightarrow 23 rightarrow 32 rightarrow 42 (add 10 , add 9 , add 10 ). In the third test case of the example, the following sequence of moves can be applied: 18 rightarrow 10 rightarrow 4 (subtract 8 , subtract 6 ). "... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
91884384 |
none126 |
A |
Sept. 4, 2020, 5:58 p.m. |
OK |
Clang++17 Diagnostics |
TESTS |
11 |
358 |
204800 |
|
|
91900098 |
fpc_coder |
A |
Sept. 5, 2020, 1:38 a.m. |
OK |
FPC |
TESTS |
11 |
93 |
0 |
|
|
91874571 |
giyasmahmudmozahed |
A |
Sept. 4, 2020, 4:32 p.m. |
OK |
GNU C11 |
TESTS |
2 |
77 |
0 |
|
|
91881028 |
Anran31 |
A |
Sept. 4, 2020, 5:14 p.m. |
OK |
GNU C11 |
TESTS |
11 |
78 |
0 |
|
|
91907048 |
yagami05 |
A |
Sept. 5, 2020, 4:49 a.m. |
OK |
GNU C11 |
TESTS |
11 |
93 |
0 |
|
|
91907565 |
Biggo111 |
A |
Sept. 5, 2020, 5 a.m. |
OK |
GNU C11 |
TESTS |
11 |
93 |
0 |
|
|
91882922 |
namanbhatia11111 |
A |
Sept. 4, 2020, 5:38 p.m. |
OK |
GNU C11 |
TESTS |
11 |
93 |
0 |
|
|
91883782 |
Prol_noob |
A |
Sept. 4, 2020, 5:50 p.m. |
OK |
GNU C11 |
TESTS |
11 |
93 |
0 |
|
|
91897636 |
johnwquigley |
A |
Sept. 4, 2020, 11:37 p.m. |
OK |
GNU C11 |
TESTS |
11 |
93 |
0 |
|
|
91905237 |
ARP75 |
A |
Sept. 5, 2020, 4:07 a.m. |
OK |
GNU C11 |
TESTS |
11 |
93 |
0 |
|
|
91879779 |
mizanur22r |
A |
Sept. 4, 2020, 5:01 p.m. |
OK |
GNU C11 |
TESTS |
6 |
93 |
0 |
|
|
91882917 |
shahd.-. |
A |
Sept. 4, 2020, 5:38 p.m. |
OK |
GNU C11 |
TESTS |
11 |
93 |
0 |
|
|
91872507 |
Lucidia |
A |
Sept. 4, 2020, 4:29 p.m. |
OK |
GNU C++11 |
TESTS |
2 |
15 |
0 |
|
|
91908008 |
luogu_bot3 |
A |
Sept. 5, 2020, 5:08 a.m. |
OK |
GNU C++11 |
TESTS |
11 |
15 |
0 |
|
|
91897494 |
xyizd |
A |
Sept. 4, 2020, 11:29 p.m. |
OK |
GNU C++11 |
TESTS |
11 |
15 |
0 |
|
|
91899715 |
Encodeous |
A |
Sept. 5, 2020, 1:21 a.m. |
OK |
GNU C++11 |
TESTS |
11 |
15 |
8396800 |
|
|
91904995 |
luogu_bot1 |
A |
Sept. 5, 2020, 4:01 a.m. |
OK |
GNU C++11 |
TESTS |
11 |
30 |
0 |
|
|
91903288 |
Flash_plus |
A |
Sept. 5, 2020, 3:19 a.m. |
OK |
GNU C++11 |
TESTS |
11 |
30 |
0 |
|
|
91898302 |
angrysqrt3 |
A |
Sept. 5, 2020, 12:10 a.m. |
OK |
GNU C++11 |
TESTS |
11 |
30 |
0 |
|
|
91875021 |
Lucidia |
A |
Sept. 4, 2020, 4:33 p.m. |
OK |
GNU C++11 |
TESTS |
2 |
30 |
0 |
|
|
91904051 |
heroes_tonight |
A |
Sept. 5, 2020, 3:38 a.m. |
OK |
GNU C++11 |
TESTS |
11 |
31 |
0 |
|
|
91906622 |
ASTROBOYZZ |
A |
Sept. 5, 2020, 4:40 a.m. |
OK |
GNU C++11 |
TESTS |
11 |
31 |
0 |
|
|
91874325 |
Spirit-of-Joy |
A |
Sept. 4, 2020, 4:32 p.m. |
OK |
GNU C++14 |
TESTS |
2 |
15 |
0 |
|
|
91875361 |
abdullrahman-kerklar |
A |
Sept. 4, 2020, 4:34 p.m. |
OK |
GNU C++14 |
TESTS |
2 |
15 |
0 |
|
|
91877663 |
theprowills |
A |
Sept. 4, 2020, 4:44 p.m. |
OK |
GNU C++14 |
TESTS |
2 |
15 |
0 |
|
|
91871585 |
B.Joshna |
A |
Sept. 4, 2020, 4:27 p.m. |
OK |
GNU C++14 |
TESTS |
2 |
15 |
0 |
|
|
91872917 |
aviabhinn98 |
A |
Sept. 4, 2020, 4:30 p.m. |
OK |
GNU C++14 |
TESTS |
2 |
15 |
0 |
|
|
91871400 |
ajil |
A |
Sept. 4, 2020, 4:26 p.m. |
OK |
GNU C++14 |
TESTS |
2 |
15 |
0 |
|
|
91908851 |
Ilove_coding |
A |
Sept. 5, 2020, 5:23 a.m. |
OK |
GNU C++14 |
TESTS |
11 |
30 |
0 |
|
|
91883746 |
_Lumos |
A |
Sept. 4, 2020, 5:50 p.m. |
OK |
GNU C++14 |
TESTS |
11 |
30 |
0 |
|
|
91876465 |
I_Love_Shivani |
A |
Sept. 4, 2020, 4:38 p.m. |
OK |
GNU C++14 |
TESTS |
2 |
30 |
0 |
|
|
91873734 |
whzzfx |
A |
Sept. 4, 2020, 4:31 p.m. |
OK |
GNU C++14 |
TESTS |
2 |
30 |
0 |
|
|
91877112 |
Suifeng0214 |
A |
Sept. 4, 2020, 4:41 p.m. |
OK |
GNU C++17 |
TESTS |
2 |
15 |
0 |
|
|
91877234 |
arman.... |
A |
Sept. 4, 2020, 4:41 p.m. |
OK |
GNU C++17 |
TESTS |
2 |
15 |
0 |
|
|
91872545 |
JacobianDet |
A |
Sept. 4, 2020, 4:29 p.m. |
OK |
GNU C++17 |
TESTS |
2 |
15 |
2457600 |
|
|
91899299 |
Yoshinow2001 |
A |
Sept. 5, 2020, 1:04 a.m. |
OK |
GNU C++17 |
TESTS |
11 |
30 |
0 |
|
|
91888409 |
Sirajsj |
A |
Sept. 4, 2020, 7:02 p.m. |
OK |
GNU C++17 |
TESTS |
11 |
30 |
0 |
|
|
91886028 |
gs313 |
A |
Sept. 4, 2020, 6:22 p.m. |
OK |
GNU C++17 |
TESTS |
11 |
30 |
0 |
|
|
91879878 |
Gau_rav123 |
A |
Sept. 4, 2020, 5:02 p.m. |
OK |
GNU C++17 |
TESTS |
6 |
30 |
0 |
|
|
91899721 |
hachuochuo. |
A |
Sept. 5, 2020, 1:22 a.m. |
OK |
GNU C++17 |
TESTS |
11 |
30 |
0 |
|
|
91899680 |
N_0NY |
A |
Sept. 5, 2020, 1:20 a.m. |
OK |
GNU C++17 |
TESTS |
11 |
30 |
0 |
|
|
91898918 |
Gabo_03 |
A |
Sept. 5, 2020, 12:44 a.m. |
OK |
GNU C++17 |
TESTS |
11 |
30 |
0 |
|
|
91877051 |
FlowerOfSorrow |
A |
Sept. 4, 2020, 4:40 p.m. |
OK |
GNU C++17 (64) |
TESTS |
2 |
15 |
0 |
|
|
91877600 |
Ketaki |
A |
Sept. 4, 2020, 4:44 p.m. |
OK |
GNU C++17 (64) |
TESTS |
2 |
15 |
0 |
|
|
91898543 |
ballerbuoy |
A |
Sept. 5, 2020, 12:22 a.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
15 |
0 |
|
|
91888942 |
David_Garcia |
A |
Sept. 4, 2020, 7:11 p.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
30 |
0 |
|
|
91904549 |
Dragon_Emperor |
A |
Sept. 5, 2020, 3:50 a.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
30 |
0 |
|
|
91903085 |
ankeet |
A |
Sept. 5, 2020, 3:14 a.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
30 |
0 |
|
|
91885471 |
user9029 |
A |
Sept. 4, 2020, 6:14 p.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
30 |
0 |
|
|
91881540 |
adi2710 |
A |
Sept. 4, 2020, 5:20 p.m. |
OK |
GNU C++17 (64) |
TESTS |
11 |
30 |
0 |
|
|
91879381 |
roshan_mehta |
A |
Sept. 4, 2020, 4:57 p.m. |
OK |
GNU C++17 (64) |
TESTS |
6 |
30 |
0 |
|
|
91877102 |
break2000 |
A |
Sept. 4, 2020, 4:41 p.m. |
OK |
GNU C++17 (64) |
TESTS |
2 |
30 |
0 |
|
|
91904000 |
Trishan |
A |
Sept. 5, 2020, 3:37 a.m. |
OK |
Go |
TESTS |
11 |
108 |
1126400 |
|
|
91908026 |
bnurgeldiyev514 |
A |
Sept. 5, 2020, 5:09 a.m. |
OK |
Go |
TESTS |
11 |
124 |
0 |
|
|
91893626 |
cifrzak |
A |
Sept. 4, 2020, 8:59 p.m. |
OK |
Go |
TESTS |
11 |
140 |
307200 |
|
|
91882062 |
codego144 |
A |
Sept. 4, 2020, 5:27 p.m. |
OK |
Java 11 |
TESTS |
11 |
171 |
0 |
|
|
91887517 |
01naveenv |
A |
Sept. 4, 2020, 6:46 p.m. |
OK |
Java 11 |
TESTS |
11 |
171 |
0 |
|
|
91894360 |
jainbot27 |
A |
Sept. 4, 2020, 9:22 p.m. |
OK |
Java 11 |
TESTS |
11 |
186 |
0 |
|
|
91886378 |
skittles1412 |
A |
Sept. 4, 2020, 6:27 p.m. |
OK |
Java 11 |
TESTS |
11 |
186 |
204800 |
|
|
91896816 |
kadintang1 |
A |
Sept. 4, 2020, 10:54 p.m. |
OK |
Java 11 |
TESTS |
11 |
187 |
0 |
|
|
91891568 |
adhi_2311 |
A |
Sept. 4, 2020, 8:02 p.m. |
OK |
Java 11 |
TESTS |
11 |
187 |
0 |
|
|
91885615 |
AnmolNg |
A |
Sept. 4, 2020, 6:16 p.m. |
OK |
Java 11 |
TESTS |
11 |
187 |
0 |
|
|
91904711 |
Witless_Deer |
A |
Sept. 5, 2020, 3:55 a.m. |
OK |
Java 11 |
TESTS |
11 |
187 |
0 |
|
|
91903668 |
Jael |
A |
Sept. 5, 2020, 3:29 a.m. |
OK |
Java 11 |
TESTS |
11 |
187 |
0 |
|
|
91911069 |
kiberKotleta2009 |
A |
Sept. 5, 2020, 6:01 a.m. |
OK |
Java 11 |
TESTS |
11 |
202 |
0 |
|
|
91877194 |
Mr.Awesome |
A |
Sept. 4, 2020, 4:41 p.m. |
OK |
Java 8 |
TESTS |
2 |
78 |
0 |
|
|
91882949 |
Snow |
A |
Sept. 4, 2020, 5:38 p.m. |
OK |
Java 8 |
TESTS |
11 |
108 |
0 |
|
|
91881238 |
ansh_shanker |
A |
Sept. 4, 2020, 5:17 p.m. |
OK |
Java 8 |
TESTS |
11 |
108 |
0 |
|
|
91879086 |
ShesMyNerd |
A |
Sept. 4, 2020, 4:55 p.m. |
OK |
Java 8 |
TESTS |
6 |
108 |
0 |
|
|
91903633 |
Manan8686 |
A |
Sept. 5, 2020, 3:29 a.m. |
OK |
Java 8 |
TESTS |
11 |
109 |
0 |
|
|
91881837 |
Nirav412000 |
A |
Sept. 4, 2020, 5:24 p.m. |
OK |
Java 8 |
TESTS |
11 |
109 |
0 |
|
|
91895895 |
texasaboy1 |
A |
Sept. 4, 2020, 10:16 p.m. |
OK |
Java 8 |
TESTS |
11 |
124 |
0 |
|
|
91910461 |
mananparmar7042 |
A |
Sept. 5, 2020, 5:52 a.m. |
OK |
Java 8 |
TESTS |
11 |
124 |
0 |
|
|
91904179 |
khedu |
A |
Sept. 5, 2020, 3:41 a.m. |
OK |
Java 8 |
TESTS |
11 |
124 |
0 |
|
|
91896602 |
AmmarAlsharif |
A |
Sept. 4, 2020, 10:44 p.m. |
OK |
Java 8 |
TESTS |
11 |
124 |
0 |
|
|
91906771 |
Spheniscine |
A |
Sept. 5, 2020, 4:43 a.m. |
OK |
Kotlin |
TESTS |
11 |
139 |
0 |
|
|
91872562 |
eneskayiklik |
A |
Sept. 4, 2020, 4:29 p.m. |
OK |
Kotlin |
TESTS |
2 |
312 |
0 |
|
|
91904974 |
VisiOrigin |
A |
Sept. 5, 2020, 4:01 a.m. |
OK |
Mono C# |
TESTS |
11 |
140 |
6860800 |
|
|
91881953 |
vjudge3 |
A |
Sept. 4, 2020, 5:26 p.m. |
OK |
MS C++ |
TESTS |
11 |
93 |
0 |
|
|
91906200 |
nay_1234 |
A |
Sept. 5, 2020, 4:31 a.m. |
OK |
MS C++ |
TESTS |
11 |
108 |
0 |
|
|
91900564 |
5130 |
A |
Sept. 5, 2020, 1:55 a.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
46 |
0 |
|
|
91885768 |
aymenbenammar890 |
A |
Sept. 4, 2020, 6:19 p.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
46 |
307200 |
|
|
91899291 |
gao_wu_di |
A |
Sept. 5, 2020, 1:04 a.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
93 |
0 |
|
|
91907273 |
AineshGupta |
A |
Sept. 5, 2020, 4:53 a.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
109 |
0 |
|
|
91906077 |
Gravekper |
A |
Sept. 5, 2020, 4:28 a.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
124 |
0 |
|
|
91910947 |
rokirovochka |
A |
Sept. 5, 2020, 6 a.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
124 |
0 |
|
|
91908361 |
harry12138 |
A |
Sept. 5, 2020, 5:15 a.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
124 |
0 |
|
|
91874864 |
Marcus0086 |
A |
Sept. 4, 2020, 4:33 p.m. |
OK |
MS C++ 2017 |
TESTS |
2 |
124 |
0 |
|
|
91877890 |
varvarkins |
A |
Sept. 4, 2020, 4:46 p.m. |
OK |
MS C++ 2017 |
TESTS |
6 |
124 |
307200 |
|
|
91885188 |
shakyawar.r |
A |
Sept. 4, 2020, 6:10 p.m. |
OK |
MS C++ 2017 |
TESTS |
11 |
140 |
307200 |
|
|
91907718 |
gintoki_s |
A |
Sept. 5, 2020, 5:03 a.m. |
OK |
PyPy 3 |
TESTS |
11 |
187 |
3379200 |
|
|
91905264 |
FahimSifnatul |
A |
Sept. 5, 2020, 4:08 a.m. |
OK |
PyPy 3 |
TESTS |
11 |
187 |
5120000 |
|
|
91882718 |
cs17btech11002 |
A |
Sept. 4, 2020, 5:35 p.m. |
OK |
PyPy 3 |
TESTS |
11 |
202 |
4505600 |
|
|
91884952 |
petya47 |
A |
Sept. 4, 2020, 6:06 p.m. |
OK |
PyPy 3 |
TESTS |
11 |
202 |
5939200 |
|
|
91906424 |
vishwesh20 |
A |
Sept. 5, 2020, 4:36 a.m. |
OK |
PyPy 3 |
TESTS |
11 |
202 |
5939200 |
|
|
91889219 |
420__IQ |
A |
Sept. 4, 2020, 7:16 p.m. |
OK |
PyPy 3 |
TESTS |
11 |
202 |
6348800 |
|
|
91882013 |
AggarwalRaghav |
A |
Sept. 4, 2020, 5:26 p.m. |
OK |
PyPy 3 |
TESTS |
11 |
217 |
5836800 |
|
|
91899501 |
Jael |
A |
Sept. 5, 2020, 1:13 a.m. |
OK |
PyPy 3 |
TESTS |
11 |
217 |
7884800 |
|
|
91877248 |
Coki628 |
A |
Sept. 4, 2020, 4:41 p.m. |
OK |
PyPy 3 |
TESTS |
2 |
218 |
5529600 |
|
|
91892936 |
Nifer |
A |
Sept. 4, 2020, 8:40 p.m. |
OK |
PyPy 3 |
TESTS |
11 |
218 |
6348800 |
|
|
91889424 |
samuelhafsteins |
A |
Sept. 4, 2020, 7:20 p.m. |
OK |
Python 2 |
TESTS |
11 |
202 |
307200 |
|
|
91880291 |
samars_diary |
A |
Sept. 4, 2020, 5:06 p.m. |
OK |
Python 3 |
TESTS |
6 |
124 |
1945600 |
|
|
91879480 |
samars_diary |
A |
Sept. 4, 2020, 4:58 p.m. |
OK |
Python 3 |
TESTS |
6 |
139 |
307200 |
|
|
91896498 |
BugLeave |
A |
Sept. 4, 2020, 10:40 p.m. |
OK |
Python 3 |
TESTS |
11 |
140 |
1536000 |
|
|
91880690 |
samars_diary |
A |
Sept. 4, 2020, 5:10 p.m. |
OK |
Python 3 |
TESTS |
6 |
140 |
1843200 |
|
|
91881056 |
samars_diary |
A |
Sept. 4, 2020, 5:14 p.m. |
OK |
Python 3 |
TESTS |
11 |
155 |
307200 |
|
|
91878083 |
samars_diary |
A |
Sept. 4, 2020, 4:47 p.m. |
OK |
Python 3 |
TESTS |
6 |
155 |
307200 |
|
|
91877578 |
samars_diary |
A |
Sept. 4, 2020, 4:43 p.m. |
OK |
Python 3 |
TESTS |
2 |
155 |
307200 |
|
|
91898791 |
khealer |
A |
Sept. 5, 2020, 12:36 a.m. |
OK |
Python 3 |
TESTS |
11 |
155 |
1945600 |
|
|
91881250 |
samars_diary |
A |
Sept. 4, 2020, 5:17 p.m. |
OK |
Python 3 |
TESTS |
11 |
156 |
307200 |
|
|
91873959 |
satyamkhare |
A |
Sept. 4, 2020, 4:31 p.m. |
OK |
Python 3 |
TESTS |
2 |
171 |
716800 |
|
|
91891219 |
Andrey_R |
A |
Sept. 4, 2020, 7:54 p.m. |
OK |
Ruby |
TESTS |
11 |
530 |
204800 |
|
|
91906645 |
quanjun |
A |
Sept. 5, 2020, 4:40 a.m. |
OK |
Rust |
TESTS |
11 |
218 |
0 |
|
|
remove filters
Back to search problems