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'Vova has taken his summer practice this year and now he should write a report on how it went. Vova has already drawn all the tables and wrote down all the formulas. Moreover, he has already decided that the report will consist of exactly n pages and the i -th page will include x_i tables and y_i formulas. The pages are numbered from 1 to n . Vova fills the pages one after another, he can 't go filling page i + 1 before finishing page i and he can 't skip pages. However, if he draws strictly more than k tables in a row or writes strictly more than k formulas in a row then he will get bored. Vova wants to rearrange tables and formulas in each page in such a way that he doesn 't get bored in the process. Vova can 't move some table or some formula to another page. Note that the count doesn 't reset on the start of the new page. For example, if the page ends with 3 tables and the next page starts with 5 tables, then it 's counted as 8 tables in a row. Help Vova to determine if he can rearrange tables and formulas on each page in such a way that there is no more than k tables in a row and no more than k formulas in a row. The first line contains two integers n and k ( 1 <= n <= 3 cdot 10^5 , 1 <= k <= 10^6 ). The second line contains n integers x_1, x_2, ... , x_n ( 1 <= x_i <= 10^6 ) -- the number of tables on the i -th page. The third line contains n integers y_1, y_2, ... , y_n ( 1 <= y_i <= 10^6 ) -- the number of formulas on the i -th page. Print "YES" if Vova can rearrange tables and formulas on each page in such a way that there is no more than k tables in a row and no more than k formulas in a row. Otherwise print "NO". In the first example the only option to rearrange everything is the following (let table be 'T ' and formula be 'F '): That way all blocks of tables have length 2 .'... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
45653993 |
ruban |
F |
Nov. 13, 2018, 4:42 a.m. |
OK |
Delphi |
TESTS |
71 |
155 |
73216000 |
|
2500 |
49538766 |
rainboy |
F |
Feb. 6, 2019, 5:18 p.m. |
OK |
GNU C11 |
TESTS |
71 |
124 |
4812800 |
|
2500 |
47022214 |
AuqaKyz |
F |
Dec. 15, 2018, 3:47 a.m. |
OK |
GNU C++11 |
TESTS |
71 |
31 |
4812800 |
|
2500 |
54732116 |
207M |
F |
May 28, 2019, 1:28 a.m. |
OK |
GNU C++11 |
TESTS |
71 |
46 |
2457600 |
|
2500 |
45694481 |
copyrightpoiiiii |
F |
Nov. 14, 2018, 1:06 a.m. |
OK |
GNU C++11 |
TESTS |
71 |
46 |
2457600 |
|
2500 |
54732150 |
luogu_bot3 |
F |
May 28, 2019, 1:30 a.m. |
OK |
GNU C++11 |
TESTS |
71 |
46 |
2457600 |
|
2500 |
45650549 |
orzwaz |
F |
Nov. 13, 2018, 12:44 a.m. |
OK |
GNU C++11 |
TESTS |
71 |
46 |
4812800 |
|
2500 |
47550341 |
luogu_bot5 |
F |
Dec. 27, 2018, 12:41 p.m. |
OK |
GNU C++11 |
TESTS |
71 |
46 |
4812800 |
|
2500 |
53013282 |
Scut82 |
F |
April 19, 2019, 1:03 p.m. |
OK |
GNU C++11 |
TESTS |
71 |
46 |
7270400 |
|
2500 |
53013278 |
Scut82 |
F |
April 19, 2019, 1:03 p.m. |
OK |
GNU C++11 |
TESTS |
71 |
46 |
7270400 |
|
2500 |
45667959 |
hlhhlhhlh |
F |
Nov. 13, 2018, 8:48 a.m. |
OK |
GNU C++11 |
TESTS |
71 |
46 |
7270400 |
|
2500 |
53013285 |
Scut82 |
F |
April 19, 2019, 1:03 p.m. |
OK |
GNU C++11 |
TESTS |
71 |
46 |
7270400 |
|
2500 |
45633793 |
tokitsukaze |
F |
Nov. 12, 2018, 6:02 p.m. |
OK |
GNU C++14 |
TESTS |
71 |
46 |
9728000 |
|
2500 |
45755768 |
Xin-Jie |
F |
Nov. 15, 2018, 5:44 a.m. |
OK |
GNU C++14 |
TESTS |
71 |
109 |
4812800 |
|
2500 |
45637014 |
tataky |
F |
Nov. 12, 2018, 7:49 p.m. |
OK |
GNU C++14 |
TESTS |
71 |
124 |
4812800 |
|
2500 |
45636501 |
tataky |
F |
Nov. 12, 2018, 7:32 p.m. |
OK |
GNU C++14 |
TESTS |
71 |
124 |
4812800 |
|
2500 |
45755797 |
Xin-Jie |
F |
Nov. 15, 2018, 5:45 a.m. |
OK |
GNU C++14 |
TESTS |
71 |
124 |
4812800 |
|
2500 |
47549577 |
bestFy |
F |
Dec. 27, 2018, 12:16 p.m. |
OK |
GNU C++14 |
TESTS |
71 |
140 |
2457600 |
|
2500 |
45663919 |
xdu_lhz |
F |
Nov. 13, 2018, 7:20 a.m. |
OK |
GNU C++14 |
TESTS |
71 |
140 |
2457600 |
|
2500 |
45663730 |
xdu_lhz |
F |
Nov. 13, 2018, 7:12 a.m. |
OK |
GNU C++14 |
TESTS |
71 |
140 |
2457600 |
|
2500 |
45634784 |
kirisame |
F |
Nov. 12, 2018, 6:33 p.m. |
OK |
GNU C++14 |
TESTS |
71 |
140 |
2457600 |
|
2500 |
51850725 |
PureWhite |
F |
March 26, 2019, 7:47 a.m. |
OK |
GNU C++14 |
TESTS |
71 |
140 |
2457600 |
|
2500 |
48657214 |
ReaLNero1 |
F |
Jan. 21, 2019, 3:36 a.m. |
OK |
GNU C++17 |
TESTS |
71 |
46 |
8396800 |
|
2500 |
45896979 |
mohamedeltair |
F |
Nov. 17, 2018, 11:50 p.m. |
OK |
GNU C++17 |
TESTS |
71 |
109 |
5120000 |
|
2500 |
45895334 |
mohamedeltair |
F |
Nov. 17, 2018, 9:45 p.m. |
OK |
GNU C++17 |
TESTS |
71 |
124 |
5017600 |
|
2500 |
45897205 |
mohamedeltair |
F |
Nov. 18, 2018, 12:15 a.m. |
OK |
GNU C++17 |
TESTS |
71 |
124 |
5017600 |
|
2500 |
46932418 |
xz153531 |
F |
Dec. 12, 2018, 12:17 p.m. |
OK |
GNU C++17 |
TESTS |
71 |
140 |
2457600 |
|
2500 |
45702897 |
yizhibaiwuya |
F |
Nov. 14, 2018, 9:42 a.m. |
OK |
GNU C++17 |
TESTS |
71 |
140 |
2662400 |
|
2500 |
45651264 |
384226056 |
F |
Nov. 13, 2018, 1:40 a.m. |
OK |
GNU C++17 |
TESTS |
71 |
140 |
5120000 |
|
2500 |
45999698 |
cjnwq |
F |
Nov. 20, 2018, 1:56 p.m. |
OK |
GNU C++17 |
TESTS |
71 |
155 |
2662400 |
|
2500 |
46013223 |
isar |
F |
Nov. 20, 2018, 10:42 p.m. |
OK |
GNU C++17 |
TESTS |
71 |
155 |
2662400 |
|
2500 |
45914330 |
shuafen |
F |
Nov. 18, 2018, 1:16 p.m. |
OK |
GNU C++17 |
TESTS |
71 |
155 |
2662400 |
|
2500 |
45708711 |
PrakharJain |
F |
Nov. 14, 2018, 12:57 p.m. |
OK |
Java 8 |
TESTS |
71 |
187 |
18636800 |
|
2500 |
46017570 |
icpc_loser |
F |
Nov. 21, 2018, 5:23 a.m. |
OK |
Java 8 |
TESTS |
71 |
187 |
18739200 |
|
2500 |
67680381 |
dalt |
F |
Dec. 27, 2019, 6:01 a.m. |
OK |
Java 8 |
TESTS |
71 |
187 |
46694400 |
|
2500 |
52672238 |
xodiac |
F |
April 13, 2019, 8:03 a.m. |
OK |
Java 8 |
TESTS |
71 |
202 |
18841600 |
|
2500 |
49538767 |
Dukkha |
F |
Feb. 6, 2019, 5:18 p.m. |
OK |
Java 8 |
TESTS |
71 |
218 |
13209600 |
|
2500 |
45710470 |
bakiller |
F |
Nov. 14, 2018, 1:52 p.m. |
OK |
Java 8 |
TESTS |
71 |
780 |
0 |
|
2500 |
45672661 |
c1729 |
F |
Nov. 13, 2018, 11:31 a.m. |
OK |
PyPy 2 |
TESTS |
71 |
295 |
30515200 |
|
2500 |
45893514 |
alexey_kuldoshin |
F |
Nov. 17, 2018, 8:11 p.m. |
OK |
PyPy 3 |
TESTS |
71 |
530 |
30515200 |
|
2500 |
45632226 |
safaryan_samvel |
F |
Nov. 12, 2018, 5:24 p.m. |
OK |
Python 3 |
TESTS |
71 |
639 |
26521600 |
|
2500 |
45633749 |
armoking |
F |
Nov. 12, 2018, 6:01 p.m. |
OK |
Python 3 |
TESTS |
71 |
655 |
37068800 |
|
2500 |
45633887 |
armoking |
F |
Nov. 12, 2018, 6:04 p.m. |
OK |
Python 3 |
TESTS |
71 |
716 |
37068800 |
|
2500 |
46169226 |
I_AM_HETEROSEXUAL |
F |
Nov. 24, 2018, 12:08 p.m. |
OK |
Python 3 |
TESTS |
71 |
733 |
38092800 |
|
2500 |
45893471 |
alexey_kuldoshin |
F |
Nov. 17, 2018, 8:09 p.m. |
OK |
Python 3 |
TESTS |
71 |
1512 |
25702400 |
|
2500 |
remove filters
Back to search problems