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'In the country there are n cities and m bidirectional roads between them. Each city has an army. Army of the i-th city consists of ai soldiers. Now soldiers roam. After roaming each soldier has to either stay in his city or to go to the one of neighboring cities by at moving along at most one road. Check if is it possible that after roaming there will be exactly bi soldiers in the i-th city. First line of input consists of two integers n and m (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89100, 0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89m xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89200). Next line contains n integers a1, xe2 x80 x89a2, xe2 x80 x89..., xe2 x80 x89an (0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89ai xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89100). Next line contains n integers b1, xe2 x80 x89b2, xe2 x80 x89..., xe2 x80 x89bn (0 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89bi xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89100). Then m lines follow, each of them consists of two integers p and q (1 xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89p, xe2 x80 x89q xe2 x80 x89 xe2 x89 xa4 xe2 x80 x89n, p xe2 x80 x89 xe2 x89 xa0 xe2 x80 x89q) denoting that there is an undirected road between cities p and q. It is guaranteed that there is at most one road between each pair of cities. If the conditions can not be met output single word "NO". Otherwise output word "YES" and then n lines, each of them consisting of n integers. Number in the i-th line in the j-th column should denote how many soldiers should road from city i to city j (if i xe2 x80 x89 xe2 x89 xa0 xe2 x80 x89j) or how many soldiers should stay in city i (if i xe2 x80 x89= xe2 x80 x89j). If there are several possible answers you may output 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 |
63710529 |
HVP.exe |
E |
Oct. 29, 2019, 9:52 a.m. |
OK |
FPC |
TESTS |
47 |
62 |
64512000 |
|
2300 |
42309047 |
luogu_bot4 |
E |
Aug. 31, 2018, 1:09 p.m. |
OK |
GNU C++ |
TESTS |
47 |
31 |
409600 |
|
2300 |
41988762 |
vjudge1 |
E |
Aug. 23, 2018, 7:35 a.m. |
OK |
GNU C++ |
TESTS |
47 |
31 |
716800 |
|
2300 |
41988753 |
luogu_bot1 |
E |
Aug. 23, 2018, 7:35 a.m. |
OK |
GNU C++ |
TESTS |
47 |
31 |
716800 |
|
2300 |
41987614 |
EternalAlexander |
E |
Aug. 23, 2018, 7 a.m. |
OK |
GNU C++ |
TESTS |
47 |
31 |
4198400 |
|
2300 |
41987571 |
vjudge2 |
E |
Aug. 23, 2018, 6:59 a.m. |
OK |
GNU C++ |
TESTS |
47 |
31 |
4198400 |
|
2300 |
41674205 |
vjudge5 |
E |
Aug. 17, 2018, 7:07 a.m. |
OK |
GNU C++ |
TESTS |
47 |
31 |
4300800 |
|
2300 |
41992058 |
YZWNM |
E |
Aug. 23, 2018, 9:28 a.m. |
OK |
GNU C++ |
TESTS |
47 |
46 |
4198400 |
|
2300 |
41988693 |
luogu_bot4 |
E |
Aug. 23, 2018, 7:33 a.m. |
OK |
GNU C++ |
TESTS |
47 |
78 |
23961600 |
|
2300 |
41989397 |
vjudge2 |
E |
Aug. 23, 2018, 7:56 a.m. |
OK |
GNU C++ |
TESTS |
47 |
109 |
23961600 |
|
2300 |
49807815 |
dacin21 |
E |
Feb. 11, 2019, 9:04 p.m. |
OK |
GNU C11 |
TESTS |
47 |
31 |
307200 |
|
2300 |
67208737 |
dacin21 |
E |
Dec. 19, 2019, 1:19 p.m. |
OK |
GNU C11 |
TESTS |
47 |
31 |
307200 |
|
2300 |
67208010 |
dacin21 |
E |
Dec. 19, 2019, 1:06 p.m. |
OK |
GNU C11 |
TESTS |
47 |
31 |
307200 |
|
2300 |
67206884 |
dacin21 |
E |
Dec. 19, 2019, 12:44 p.m. |
OK |
GNU C11 |
TESTS |
47 |
31 |
307200 |
|
2300 |
67206775 |
dacin21 |
E |
Dec. 19, 2019, 12:42 p.m. |
OK |
GNU C11 |
TESTS |
47 |
31 |
307200 |
|
2300 |
67205141 |
dacin21 |
E |
Dec. 19, 2019, 12:11 p.m. |
OK |
GNU C11 |
TESTS |
47 |
31 |
307200 |
|
2300 |
67203726 |
dacin21 |
E |
Dec. 19, 2019, 11:45 a.m. |
OK |
GNU C11 |
TESTS |
47 |
31 |
307200 |
|
2300 |
49808289 |
dacin21 |
E |
Feb. 11, 2019, 9:25 p.m. |
OK |
GNU C11 |
TESTS |
47 |
31 |
307200 |
|
2300 |
49808087 |
dacin21 |
E |
Feb. 11, 2019, 9:17 p.m. |
OK |
GNU C11 |
TESTS |
47 |
31 |
307200 |
|
2300 |
49808003 |
dacin21 |
E |
Feb. 11, 2019, 9:12 p.m. |
OK |
GNU C11 |
TESTS |
47 |
31 |
307200 |
|
2300 |
58125765 |
TianPingXing |
E |
Aug. 1, 2019, 12:33 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
31 |
0 |
|
2300 |
57918138 |
wengsy |
E |
July 29, 2019, 2:52 a.m. |
OK |
GNU C++11 |
TESTS |
47 |
31 |
0 |
|
2300 |
66458352 |
BEAR0131 |
E |
Dec. 7, 2019, 1:57 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
31 |
102400 |
|
2300 |
66551911 |
XianHZ |
E |
Dec. 9, 2019, 3:14 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
31 |
102400 |
|
2300 |
66551999 |
luogu_bot4 |
E |
Dec. 9, 2019, 3:16 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
31 |
102400 |
|
2300 |
66829152 |
MonkeyKing |
E |
Dec. 14, 2019, 10 a.m. |
OK |
GNU C++11 |
TESTS |
47 |
31 |
102400 |
|
2300 |
66895635 |
chenxiaoyan |
E |
Dec. 15, 2019, 1:25 a.m. |
OK |
GNU C++11 |
TESTS |
47 |
31 |
102400 |
|
2300 |
67653134 |
spanishskies |
E |
Dec. 26, 2019, 12:55 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
31 |
102400 |
|
2300 |
66904670 |
2020skyfall |
E |
Dec. 15, 2019, 5:20 a.m. |
OK |
GNU C++11 |
TESTS |
47 |
31 |
102400 |
|
2300 |
66453360 |
vjudge5 |
E |
Dec. 7, 2019, 12:17 p.m. |
OK |
GNU C++11 |
TESTS |
47 |
31 |
102400 |
|
2300 |
47176568 |
0x0x0x0x0x0x0x0x0x0x |
E |
Dec. 17, 2018, 5:51 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
15 |
512000 |
|
2300 |
46421853 |
tob123 |
E |
Nov. 30, 2018, 10:14 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
15 |
512000 |
|
2300 |
41525722 |
roll_no_1 |
E |
Aug. 12, 2018, 11:50 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
15 |
512000 |
|
2300 |
69226516 |
ACMHIT |
E |
Jan. 21, 2020, 7:29 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
30 |
102400 |
|
2300 |
57696250 |
luogu_bot5 |
E |
July 24, 2019, 4:45 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
30 |
204800 |
|
2300 |
44528231 |
vjudge5 |
E |
Oct. 19, 2018, 4:45 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
30 |
204800 |
|
2300 |
58924488 |
khaled97ha |
E |
Aug. 16, 2019, 6:44 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
30 |
307200 |
|
2300 |
45867350 |
xproxmess |
E |
Nov. 17, 2018, 8:34 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
30 |
307200 |
|
2300 |
57742108 |
tonrist |
E |
July 25, 2019, 11:46 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
30 |
409600 |
|
2300 |
59123489 |
TianSunXing |
E |
Aug. 20, 2019, 7:09 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
30 |
409600 |
|
2300 |
64367449 |
kilotaras |
E |
Nov. 6, 2019, 1:24 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
15 |
307200 |
|
2300 |
47177837 |
Barbosa1998 |
E |
Dec. 17, 2018, 6:34 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
15 |
307200 |
|
2300 |
65496563 |
poikniok |
E |
Nov. 21, 2019, 4:50 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
15 |
307200 |
|
2300 |
52561579 |
3liAckerman |
E |
April 10, 2019, 10:43 a.m. |
OK |
GNU C++17 |
TESTS |
47 |
15 |
409600 |
|
2300 |
50750183 |
ivan100sic |
E |
March 3, 2019, 4:24 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
30 |
102400 |
|
2300 |
64863182 |
ruo |
E |
Nov. 14, 2019, 4:33 a.m. |
OK |
GNU C++17 |
TESTS |
47 |
30 |
204800 |
|
2300 |
59509151 |
NOSS |
E |
Aug. 26, 2019, 7:18 a.m. |
OK |
GNU C++17 |
TESTS |
47 |
30 |
307200 |
|
2300 |
52798338 |
Mjgonzales |
E |
April 15, 2019, 11:39 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
30 |
307200 |
|
2300 |
65498145 |
poikniok |
E |
Nov. 21, 2019, 5:30 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
30 |
307200 |
|
2300 |
50491171 |
Patiala_Peg |
E |
Feb. 25, 2019, 1:22 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
30 |
409600 |
|
2300 |
45394144 |
terry.v |
E |
Nov. 7, 2018, 2:05 a.m. |
OK |
Go |
TESTS |
47 |
109 |
0 |
|
2300 |
45381148 |
terry.v |
E |
Nov. 6, 2018, 2:52 p.m. |
OK |
Go |
TESTS |
47 |
109 |
0 |
|
2300 |
45380179 |
terry.v |
E |
Nov. 6, 2018, 2:19 p.m. |
OK |
Go |
TESTS |
47 |
109 |
0 |
|
2300 |
45379984 |
terry.v |
E |
Nov. 6, 2018, 2:12 p.m. |
OK |
Go |
TESTS |
47 |
109 |
0 |
|
2300 |
45361162 |
terry.v |
E |
Nov. 6, 2018, 9:12 a.m. |
OK |
Go |
TESTS |
47 |
109 |
0 |
|
2300 |
45352752 |
jayi |
E |
Nov. 6, 2018, 7:33 a.m. |
OK |
Go |
TESTS |
47 |
109 |
0 |
|
2300 |
45373391 |
jayi |
E |
Nov. 6, 2018, 11:08 a.m. |
OK |
Go |
TESTS |
47 |
124 |
0 |
|
2300 |
66722734 |
Mirbek_aka |
E |
Dec. 12, 2019, 3:34 p.m. |
OK |
Java 11 |
TESTS |
47 |
296 |
0 |
|
2300 |
66563804 |
ayh358 |
E |
Dec. 9, 2019, 8:23 p.m. |
OK |
Java 11 |
TESTS |
47 |
327 |
0 |
|
2300 |
67421634 |
Nutella3000 |
E |
Dec. 22, 2019, 11:54 a.m. |
OK |
Java 8 |
TESTS |
47 |
124 |
0 |
|
2300 |
65464770 |
barakraganosungam |
E |
Nov. 21, 2019, 5:12 a.m. |
OK |
Java 8 |
TESTS |
47 |
124 |
0 |
|
2300 |
59917103 |
vjvjain0 |
E |
Sept. 2, 2019, 7:48 p.m. |
OK |
Java 8 |
TESTS |
47 |
124 |
0 |
|
2300 |
44244896 |
dmitriy0712 |
E |
Oct. 13, 2018, 8:17 a.m. |
OK |
Java 8 |
TESTS |
47 |
124 |
0 |
|
2300 |
48263814 |
atlasworld |
E |
Jan. 11, 2019, 6:57 p.m. |
OK |
Java 8 |
TESTS |
47 |
139 |
0 |
|
2300 |
60410585 |
Dukkha |
E |
Sept. 11, 2019, 9:14 p.m. |
OK |
Java 8 |
TESTS |
47 |
140 |
0 |
|
2300 |
66476367 |
manavsood |
E |
Dec. 7, 2019, 9:05 p.m. |
OK |
Java 8 |
TESTS |
47 |
155 |
0 |
|
2300 |
58928123 |
Sharon |
E |
Aug. 16, 2019, 9:01 p.m. |
OK |
Java 8 |
TESTS |
47 |
202 |
0 |
|
2300 |
46391083 |
sanjay.yepuri |
E |
Nov. 30, 2018, 5:55 a.m. |
OK |
Java 8 |
TESTS |
47 |
202 |
0 |
|
2300 |
46389551 |
Shivang_Singh |
E |
Nov. 30, 2018, 4:22 a.m. |
OK |
Java 8 |
TESTS |
47 |
202 |
0 |
|
2300 |
47513878 |
moss3s |
E |
Dec. 26, 2018, 8:32 a.m. |
OK |
Kotlin |
TESTS |
47 |
171 |
1024000 |
|
2300 |
47513629 |
moss3s |
E |
Dec. 26, 2018, 8:20 a.m. |
OK |
Kotlin |
TESTS |
47 |
171 |
1024000 |
|
2300 |
47500939 |
moss3s |
E |
Dec. 25, 2018, 5:52 p.m. |
OK |
Kotlin |
TESTS |
47 |
187 |
1126400 |
|
2300 |
68143525 |
vjudge2 |
E |
Jan. 4, 2020, 1:59 a.m. |
OK |
MS C++ |
TESTS |
47 |
31 |
102400 |
|
2300 |
58140153 |
TianSunXing |
E |
Aug. 1, 2019, 5:46 p.m. |
OK |
MS C++ |
TESTS |
47 |
31 |
512000 |
|
2300 |
46292226 |
Viverae |
E |
Nov. 27, 2018, 8:48 p.m. |
OK |
MS C++ |
TESTS |
47 |
31 |
716800 |
|
2300 |
57876084 |
vjudge5 |
E |
July 28, 2019, 5:25 a.m. |
OK |
MS C++ |
TESTS |
47 |
31 |
921600 |
|
2300 |
58135310 |
TianSunXing |
E |
Aug. 1, 2019, 3:52 p.m. |
OK |
MS C++ |
TESTS |
47 |
31 |
100659200 |
|
2300 |
58132813 |
TianPingXing |
E |
Aug. 1, 2019, 2:55 p.m. |
OK |
MS C++ |
TESTS |
47 |
31 |
100659200 |
|
2300 |
58115993 |
vjudge5 |
E |
Aug. 1, 2019, 8:53 a.m. |
OK |
MS C++ |
TESTS |
47 |
46 |
307200 |
|
2300 |
58113387 |
vjudge1 |
E |
Aug. 1, 2019, 8:03 a.m. |
OK |
MS C++ |
TESTS |
47 |
46 |
409600 |
|
2300 |
56822038 |
vjudge5 |
E |
July 11, 2019, 1:26 a.m. |
OK |
MS C++ |
TESTS |
47 |
62 |
36044800 |
|
2300 |
66524613 |
chanakya999 |
E |
Dec. 9, 2019, 3:26 a.m. |
OK |
MS C++ 2017 |
TESTS |
47 |
30 |
716800 |
|
2300 |
66739770 |
niti.malwade |
E |
Dec. 12, 2019, 8:03 p.m. |
OK |
MS C++ 2017 |
TESTS |
47 |
31 |
716800 |
|
2300 |
66739296 |
anusri.shah |
E |
Dec. 12, 2019, 7:48 p.m. |
OK |
MS C++ 2017 |
TESTS |
47 |
31 |
716800 |
|
2300 |
66479646 |
AdiGadi24 |
E |
Dec. 8, 2019, 12:40 a.m. |
OK |
MS C++ 2017 |
TESTS |
47 |
31 |
716800 |
|
2300 |
66294270 |
nj5649 |
E |
Dec. 5, 2019, 2:43 a.m. |
OK |
MS C++ 2017 |
TESTS |
47 |
31 |
716800 |
|
2300 |
58153152 |
TianSunXing |
E |
Aug. 2, 2019, 3:53 a.m. |
OK |
MS C++ 2017 |
TESTS |
47 |
31 |
6144000 |
|
2300 |
66741157 |
niti.malwade |
E |
Dec. 12, 2019, 8:51 p.m. |
OK |
MS C++ 2017 |
TESTS |
47 |
46 |
614400 |
|
2300 |
66740354 |
niti.malwade |
E |
Dec. 12, 2019, 8:25 p.m. |
OK |
MS C++ 2017 |
TESTS |
47 |
46 |
614400 |
|
2300 |
57154791 |
FallingStar |
E |
July 16, 2019, 4:16 p.m. |
OK |
PyPy 3 |
TESTS |
47 |
202 |
3379200 |
|
2300 |
46387433 |
JZillifro |
E |
Nov. 30, 2018, 1:05 a.m. |
OK |
PyPy 3 |
TESTS |
47 |
311 |
10342400 |
|
2300 |
57154652 |
FallingStar |
E |
July 16, 2019, 4:12 p.m. |
OK |
Python 3 |
TESTS |
47 |
171 |
716800 |
|
2300 |
42877635 |
diemoldau |
E |
Sept. 15, 2018, 3:17 a.m. |
OK |
Python 3 |
TESTS |
47 |
249 |
1228800 |
|
2300 |
48546324 |
emma |
E |
Jan. 18, 2019, 7:47 p.m. |
OK |
Python 3 |
TESTS |
47 |
280 |
716800 |
|
2300 |
48546186 |
emma |
E |
Jan. 18, 2019, 7:41 p.m. |
OK |
Python 3 |
TESTS |
47 |
295 |
716800 |
|
2300 |
46389823 |
prupes |
E |
Nov. 30, 2018, 4:45 a.m. |
OK |
Python 3 |
TESTS |
47 |
311 |
307200 |
|
2300 |
48547114 |
emma |
E |
Jan. 18, 2019, 8:21 p.m. |
OK |
Python 3 |
TESTS |
47 |
373 |
819200 |
|
2300 |
46658038 |
garamaleki |
E |
Dec. 5, 2018, 5:28 p.m. |
OK |
Python 3 |
TESTS |
47 |
389 |
1126400 |
|
2300 |
46287822 |
madergaser |
E |
Nov. 27, 2018, 5:27 p.m. |
OK |
Python 3 |
TESTS |
47 |
421 |
819200 |
|
2300 |
46294715 |
weberchen85 |
E |
Nov. 28, 2018, 12:14 a.m. |
OK |
Python 3 |
TESTS |
47 |
436 |
716800 |
|
2300 |
remove filters
Back to search problems