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"The government of Berland decided to improve network coverage in his country. Berland has a unique structure: the capital in the center and n cities in a circle around the capital. The capital already has a good network coverage (so the government ignores it), but the i -th city contains a_i households that require a connection. The government designed a plan to build n network stations between all pairs of neighboring cities which will maintain connections only for these cities. In other words, the i -th network station will provide service only for the i -th and the (i + 1) -th city (the n -th station is connected to the n -th and the 1 -st city). All network stations have capacities: the i -th station can provide the connection to at most b_i households. Now the government asks you to check can the designed stations meet the needs of all cities or not -- that is, is it possible to assign each household a network station so that each network station i provides the connection to at most b_i households. The first line contains a single integer t ( 1 <= t <= 10^4 ) -- the number of test cases. The first line of each test case contains the single integer n ( 2 <= n <= 10^6 ) -- the number of cities and stations. The second line of each test case contains n integers ( 1 <= a_i <= 10^9 ) -- the number of households in the i -th city. The third line of each test case contains n integers ( 1 <= b_i <= 10^9 ) -- the capacities of the designed stations. It's guaranteed that the sum of n over test cases doesn't exceed 10^6 . For each test case, print YES, if the designed stations can meet the needs of all cities, or NO otherwise (case insensitive). In the first test case: In the second test case: In the third test case, the fourth city needs 5 connections, but the third and the fourth station has 4 connec"... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
85019181 |
rainboy |
F |
June 25, 2020, 3:24 p.m. |
OK |
GNU C11 |
TESTS |
65 |
373 |
11980800 |
|
|
85061740 |
Golden_Time |
F |
June 25, 2020, 5:47 p.m. |
OK |
GNU C++11 |
TESTS |
65 |
109 |
19968000 |
|
|
85082984 |
firstbuddha |
F |
June 26, 2020, 2:09 a.m. |
OK |
GNU C++11 |
TESTS |
65 |
124 |
46284800 |
|
|
85082657 |
zqrtxdy |
F |
June 26, 2020, 1:58 a.m. |
OK |
GNU C++11 |
TESTS |
65 |
186 |
20172800 |
|
|
85082629 |
zqrtxdy |
F |
June 26, 2020, 1:57 a.m. |
OK |
GNU C++11 |
TESTS |
65 |
186 |
20172800 |
|
|
85036177 |
01191020csl |
F |
June 25, 2020, 3:57 p.m. |
OK |
GNU C++11 |
TESTS |
65 |
202 |
20172800 |
|
|
85033626 |
Prabowo |
F |
June 25, 2020, 3:52 p.m. |
OK |
GNU C++11 |
TESTS |
65 |
358 |
12185600 |
|
|
85082363 |
WZYYN |
F |
June 26, 2020, 1:48 a.m. |
OK |
GNU C++11 |
TESTS |
65 |
358 |
12185600 |
|
|
85082075 |
frodakcin |
F |
June 26, 2020, 1:36 a.m. |
OK |
GNU C++11 |
TESTS |
65 |
358 |
19968000 |
|
|
85084304 |
XG20 |
F |
June 26, 2020, 2:45 a.m. |
OK |
GNU C++11 |
TESTS |
65 |
358 |
20172800 |
|
|
85031453 |
glpstkf |
F |
June 25, 2020, 3:47 p.m. |
OK |
GNU C++11 |
TESTS |
65 |
373 |
12083200 |
|
|
85018603 |
Linkus |
F |
June 25, 2020, 3:23 p.m. |
OK |
GNU C++14 |
TESTS |
65 |
187 |
19763200 |
|
|
85062188 |
xb0nS |
F |
June 25, 2020, 5:52 p.m. |
OK |
GNU C++14 |
TESTS |
65 |
499 |
15974400 |
|
|
85089218 |
zucc31801313 |
F |
June 26, 2020, 4:36 a.m. |
OK |
GNU C++14 |
TESTS |
65 |
499 |
27750400 |
|
|
85037055 |
Luan_girl |
F |
June 25, 2020, 4 p.m. |
OK |
GNU C++14 |
TESTS |
65 |
514 |
11980800 |
|
|
85087637 |
Luan_girl |
F |
June 26, 2020, 4:02 a.m. |
OK |
GNU C++14 |
TESTS |
65 |
514 |
11980800 |
|
|
85059807 |
Moririn2528 |
F |
June 25, 2020, 5:25 p.m. |
OK |
GNU C++14 |
TESTS |
65 |
514 |
14336000 |
|
|
85048588 |
rdd6584 |
F |
June 25, 2020, 4:28 p.m. |
OK |
GNU C++14 |
TESTS |
65 |
514 |
15974400 |
|
|
85084147 |
MYNAMEISSHARIFUL |
F |
June 26, 2020, 2:41 a.m. |
OK |
GNU C++14 |
TESTS |
65 |
514 |
15974400 |
|
|
85089369 |
shdut0901 |
F |
June 26, 2020, 4:39 a.m. |
OK |
GNU C++14 |
TESTS |
65 |
529 |
11980800 |
|
|
85055610 |
pqlamz |
F |
June 25, 2020, 4:50 p.m. |
OK |
GNU C++14 |
TESTS |
65 |
529 |
19763200 |
|
|
85027106 |
LayCurse |
F |
June 25, 2020, 3:38 p.m. |
OK |
GNU C++17 |
TESTS |
65 |
109 |
13824000 |
|
|
85045094 |
linxiaoxin |
F |
June 25, 2020, 4:19 p.m. |
OK |
GNU C++17 |
TESTS |
65 |
374 |
19763200 |
|
|
85044776 |
natsugiri |
F |
June 25, 2020, 4:18 p.m. |
OK |
GNU C++17 |
TESTS |
65 |
390 |
11980800 |
|
|
85043240 |
killerCS |
F |
June 25, 2020, 4:15 p.m. |
OK |
GNU C++17 |
TESTS |
65 |
421 |
23142400 |
|
|
85046474 |
TorchRik |
F |
June 25, 2020, 4:22 p.m. |
OK |
GNU C++17 |
TESTS |
65 |
514 |
11776000 |
|
|
85029607 |
firecookie |
F |
June 25, 2020, 3:43 p.m. |
OK |
GNU C++17 |
TESTS |
65 |
514 |
20582400 |
|
|
85028981 |
hank55663 |
F |
June 25, 2020, 3:42 p.m. |
OK |
GNU C++17 |
TESTS |
65 |
529 |
11980800 |
|
|
85061795 |
18481574_00 |
F |
June 25, 2020, 5:48 p.m. |
OK |
GNU C++17 |
TESTS |
65 |
529 |
11980800 |
|
|
85080294 |
Fischer |
F |
June 26, 2020, 12:26 a.m. |
OK |
GNU C++17 |
TESTS |
65 |
529 |
23756800 |
|
|
85033134 |
Medeowex |
F |
June 25, 2020, 3:50 p.m. |
OK |
GNU C++17 |
TESTS |
65 |
530 |
19763200 |
|
|
85026465 |
liouzhou_101 |
F |
June 25, 2020, 3:37 p.m. |
OK |
GNU C++17 (64) |
TESTS |
65 |
218 |
38707200 |
|
|
85075199 |
timf1089 |
F |
June 25, 2020, 9:27 p.m. |
OK |
GNU C++17 (64) |
TESTS |
65 |
358 |
12595200 |
|
|
85044848 |
Egor.Lifar |
F |
June 25, 2020, 4:19 p.m. |
OK |
GNU C++17 (64) |
TESTS |
65 |
358 |
20582400 |
|
|
85052358 |
Marckess |
F |
June 25, 2020, 4:34 p.m. |
OK |
GNU C++17 (64) |
TESTS |
65 |
358 |
28569600 |
|
|
85065106 |
ollpu |
F |
June 25, 2020, 6:30 p.m. |
OK |
GNU C++17 (64) |
TESTS |
65 |
373 |
12595200 |
|
|
85069466 |
Geothermal |
F |
June 25, 2020, 7:31 p.m. |
OK |
GNU C++17 (64) |
TESTS |
65 |
374 |
12595200 |
|
|
85082158 |
rniya |
F |
June 26, 2020, 1:39 a.m. |
OK |
GNU C++17 (64) |
TESTS |
65 |
374 |
12595200 |
|
|
85081475 |
heyuhhh |
F |
June 26, 2020, 1:13 a.m. |
OK |
GNU C++17 (64) |
TESTS |
65 |
374 |
12595200 |
|
|
85038800 |
noimi |
F |
June 25, 2020, 4:04 p.m. |
OK |
GNU C++17 (64) |
TESTS |
65 |
374 |
12595200 |
|
|
85034898 |
jiangly |
F |
June 25, 2020, 3:55 p.m. |
OK |
GNU C++17 (64) |
TESTS |
65 |
374 |
12595200 |
|
|
85078859 |
Thallium_is_Vegetable |
F |
June 25, 2020, 11:31 p.m. |
OK |
Go |
TESTS |
65 |
545 |
43315200 |
|
|
85021031 |
Dukkha |
F |
June 25, 2020, 3:27 p.m. |
OK |
Java 11 |
TESTS |
65 |
327 |
58880000 |
|
|
85033966 |
uwi |
F |
June 25, 2020, 3:52 p.m. |
OK |
Java 11 |
TESTS |
65 |
327 |
58982400 |
|
|
85064571 |
half_blood000 |
F |
June 25, 2020, 6:23 p.m. |
OK |
Java 11 |
TESTS |
65 |
639 |
99225600 |
|
|
85050115 |
ZeyadKhattab |
F |
June 25, 2020, 4:31 p.m. |
OK |
Java 11 |
TESTS |
65 |
686 |
96665600 |
|
|
85044445 |
14visheshjain |
F |
June 25, 2020, 4:18 p.m. |
OK |
Java 11 |
TESTS |
65 |
748 |
112640000 |
|
|
85086164 |
SecondThread |
F |
June 26, 2020, 3:28 a.m. |
OK |
Java 11 |
TESTS |
65 |
779 |
112640000 |
|
|
85036410 |
Hemose |
F |
June 25, 2020, 3:58 p.m. |
OK |
Java 11 |
TESTS |
65 |
780 |
96665600 |
|
|
85087239 |
SecondThread |
F |
June 26, 2020, 3:53 a.m. |
OK |
Java 11 |
TESTS |
65 |
780 |
139468800 |
|
|
85087258 |
SecondThread |
F |
June 26, 2020, 3:54 a.m. |
OK |
Java 11 |
TESTS |
65 |
795 |
139468800 |
|
|
85031987 |
Charlesna |
F |
June 25, 2020, 3:48 p.m. |
OK |
Java 8 |
TESTS |
65 |
467 |
88780800 |
|
|
85066525 |
jerdno |
F |
June 25, 2020, 6:48 p.m. |
OK |
Java 8 |
TESTS |
65 |
514 |
96460800 |
|
|
85075947 |
Magikarp1 |
F |
June 25, 2020, 9:47 p.m. |
OK |
Java 8 |
TESTS |
65 |
576 |
116633600 |
|
|
85078048 |
Hakiobo |
F |
June 25, 2020, 10:57 p.m. |
OK |
Kotlin |
TESTS |
65 |
685 |
29388800 |
|
|
85057681 |
Hakiobo |
F |
June 25, 2020, 5:04 p.m. |
OK |
Kotlin |
TESTS |
65 |
701 |
37478400 |
|
|
85056834 |
Hakiobo |
F |
June 25, 2020, 4:58 p.m. |
OK |
Kotlin |
TESTS |
65 |
748 |
38707200 |
|
|
85027686 |
Tlatoani |
F |
June 25, 2020, 3:39 p.m. |
OK |
Kotlin |
TESTS |
65 |
1091 |
179507200 |
|
|
85058786 |
xsc |
F |
June 25, 2020, 5:15 p.m. |
OK |
MS C++ 2017 |
TESTS |
65 |
655 |
11980800 |
|
|
85046926 |
pichulia |
F |
June 25, 2020, 4:23 p.m. |
OK |
MS C++ 2017 |
TESTS |
65 |
670 |
44032000 |
|
|
85032755 |
BpeMeHHa91_TryDHocTb |
F |
June 25, 2020, 3:50 p.m. |
OK |
MS C++ 2017 |
TESTS |
65 |
935 |
131993600 |
|
|
85031564 |
BpeMeHHa91_TryDHocTb |
F |
June 25, 2020, 3:47 p.m. |
OK |
MS C++ 2017 |
TESTS |
65 |
1903 |
131993600 |
|
|
85041664 |
Gravekper |
F |
June 25, 2020, 4:11 p.m. |
OK |
MS C++ 2017 |
TESTS |
65 |
1949 |
25804800 |
|
|
85030938 |
BpeMeHHa91_TryDHocTb |
F |
June 25, 2020, 3:46 p.m. |
OK |
MS C++ 2017 |
TESTS |
65 |
1949 |
131993600 |
|
|
85041504 |
realnimish |
F |
June 25, 2020, 4:10 p.m. |
OK |
PyPy 2 |
TESTS |
65 |
655 |
142643200 |
|
|
85058564 |
sh1194 |
F |
June 25, 2020, 5:13 p.m. |
OK |
PyPy 3 |
TESTS |
65 |
1497 |
122265600 |
|
|
85058903 |
sh1194 |
F |
June 25, 2020, 5:16 p.m. |
OK |
PyPy 3 |
TESTS |
65 |
1528 |
122265600 |
|
|
85058133 |
sh1194 |
F |
June 25, 2020, 5:08 p.m. |
OK |
PyPy 3 |
TESTS |
65 |
1544 |
122163200 |
|
|
85050214 |
chinerist |
F |
June 25, 2020, 4:31 p.m. |
OK |
PyPy 3 |
TESTS |
65 |
1544 |
122163200 |
|
|
85059013 |
sh1194 |
F |
June 25, 2020, 5:17 p.m. |
OK |
PyPy 3 |
TESTS |
65 |
1575 |
122572800 |
|
|
85080469 |
taoboquan1 |
F |
June 26, 2020, 12:33 a.m. |
OK |
PyPy 3 |
TESTS |
65 |
1980 |
105676800 |
|
|
85051674 |
killa_vanilla |
F |
June 25, 2020, 4:34 p.m. |
OK |
PyPy 3 |
TESTS |
65 |
1996 |
105984000 |
|
|
85044545 |
xDister |
F |
June 25, 2020, 4:18 p.m. |
OK |
PyPy 3 |
TESTS |
65 |
1996 |
114278400 |
|
|
85058320 |
sansen |
F |
June 25, 2020, 5:10 p.m. |
OK |
Rust |
TESTS |
65 |
358 |
54988800 |
|
|
remove filters
Back to search problems