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
Solved$ |
Index |
Name |
Type |
Tags |
Community Tag |
Rating |
( 294 ) |
F |
MCF |
PROGRAMMING |
flows |
|
|
B'You are given a graph consisting of n vertices and m directed arcs. The i -th arc goes from the vertex x_i to the vertex y_i , has capacity c_i and weight w_i . No arc goes into the vertex 1 , and no arc goes from the vertex n . There are no cycles of negative weight in the graph (it is impossible to travel from any vertex to itself in such a way that the total weight of all arcs you go through is negative). You have to assign each arc a flow (an integer between 0 and its capacity, inclusive). For every vertex except 1 and n , the total flow on the arcs going to this vertex must be equal to the total flow on the arcs going from that vertex. Let the flow on the i -th arc be f_i , then the cost of the flow is equal to sum limits_{i = 1}^{m} f_i w_i . You have to find a flow which minimizes the cost. Sounds classical, right? Well, we have some additional constraints on the flow on every edge: Can you solve this problem? The first line contains two integers n and m ( 2 <= n <= 100 ; 1 <= m <= 200 ). Then m lines follow. The i -th of them contains four integers x_i , y_i , c_i , and w_i ( 1 <= x_i <= n - 1 ; 2 <= y_i <= n ; x_i ne y_i ; 1 <= c_i <= 100 ; -100 <= w_i <= 100 ). These integers describe the i -th arc. Additional constraints on the input: If a flow satisfying all of the constraints does not exist, print Impossible. Otherwise, print two lines: If there are multiple answers, print any of them. Note that the cost of the flow should be minimized. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
185134999 |
wsday |
F |
Dec. 14, 2022, 3:01 a.m. |
OK |
GNU C++14 |
TESTS |
119 |
15 |
0 |
|
|
185047708 |
Daniel777 |
F |
Dec. 13, 2022, 8:30 a.m. |
OK |
GNU C++14 |
TESTS |
119 |
15 |
0 |
|
|
185133792 |
Yuki991 |
F |
Dec. 14, 2022, 2:24 a.m. |
OK |
GNU C++14 |
TESTS |
119 |
15 |
102400 |
|
|
185024321 |
TSmithMSU |
F |
Dec. 13, 2022, 2:33 a.m. |
OK |
GNU C++14 |
TESTS |
119 |
15 |
102400 |
|
|
185053666 |
yyf_0404 |
F |
Dec. 13, 2022, 9:21 a.m. |
OK |
GNU C++14 |
TESTS |
119 |
15 |
204800 |
|
|
185041420 |
arliedevin |
F |
Dec. 13, 2022, 7:16 a.m. |
OK |
GNU C++14 |
TESTS |
119 |
15 |
204800 |
|
|
185024516 |
Cxny |
F |
Dec. 13, 2022, 2:36 a.m. |
OK |
GNU C++17 |
TESTS |
119 |
15 |
0 |
|
|
185121087 |
omar_ayman_21 |
F |
Dec. 13, 2022, 8:17 p.m. |
OK |
GNU C++17 |
TESTS |
119 |
15 |
204800 |
|
|
185015867 |
as3413332 |
F |
Dec. 12, 2022, 10:28 p.m. |
OK |
GNU C++17 |
TESTS |
119 |
15 |
1843200 |
|
|
185122760 |
AhmedMurtaja |
F |
Dec. 13, 2022, 9 p.m. |
OK |
GNU C++17 |
TESTS |
119 |
15 |
4403200 |
|
|
185119902 |
code-l404b |
F |
Dec. 13, 2022, 7:29 p.m. |
OK |
GNU C++17 |
TESTS |
119 |
15 |
4403200 |
|
|
185093021 |
googlefoduga |
F |
Dec. 13, 2022, 3:13 p.m. |
OK |
GNU C++17 |
TESTS |
119 |
15 |
4403200 |
|
|
185024083 |
xiaoziyaoo |
F |
Dec. 13, 2022, 2:28 a.m. |
OK |
GNU C++17 |
TESTS |
119 |
15 |
4403200 |
|
|
185138011 |
TheHomelander |
F |
Dec. 14, 2022, 4:11 a.m. |
OK |
GNU C++17 |
TESTS |
119 |
30 |
204800 |
|
|
185122609 |
hjcafaroUC |
F |
Dec. 13, 2022, 8:57 p.m. |
OK |
GNU C++17 |
TESTS |
119 |
31 |
512000 |
|
|
185111795 |
zzpcd |
F |
Dec. 13, 2022, 5:55 p.m. |
OK |
GNU C++17 (64) |
TESTS |
119 |
15 |
0 |
|
|
185089664 |
nweeks |
F |
Dec. 13, 2022, 2:45 p.m. |
OK |
GNU C++17 (64) |
TESTS |
119 |
15 |
102400 |
|
|
185089530 |
nweeks |
F |
Dec. 13, 2022, 2:43 p.m. |
OK |
GNU C++17 (64) |
TESTS |
119 |
15 |
102400 |
|
|
185079749 |
zhangboju |
F |
Dec. 13, 2022, 1:22 p.m. |
OK |
GNU C++17 (64) |
TESTS |
119 |
15 |
102400 |
|
|
185044541 |
kimoyami |
F |
Dec. 13, 2022, 7:50 a.m. |
OK |
GNU C++17 (64) |
TESTS |
119 |
15 |
102400 |
|
|
185133174 |
Alex_Wei |
F |
Dec. 14, 2022, 2:04 a.m. |
OK |
GNU C++17 (64) |
TESTS |
119 |
15 |
204800 |
|
|
185025112 |
Alex_Wei |
F |
Dec. 13, 2022, 2:49 a.m. |
OK |
GNU C++17 (64) |
TESTS |
119 |
15 |
204800 |
|
|
185022574 |
Alex_Wei |
F |
Dec. 13, 2022, 1:50 a.m. |
OK |
GNU C++17 (64) |
TESTS |
119 |
15 |
204800 |
|
|
185122864 |
korokseeds |
F |
Dec. 13, 2022, 9:02 p.m. |
OK |
GNU C++17 (64) |
TESTS |
119 |
15 |
307200 |
|
|
185122525 |
korokseeds |
F |
Dec. 13, 2022, 8:56 p.m. |
OK |
GNU C++17 (64) |
TESTS |
119 |
15 |
307200 |
|
|
185135672 |
luogu_bot3 |
F |
Dec. 14, 2022, 3:19 a.m. |
OK |
GNU C++20 (64) |
TESTS |
119 |
15 |
0 |
|
|
185135176 |
Zesty_Fox |
F |
Dec. 14, 2022, 3:06 a.m. |
OK |
GNU C++20 (64) |
TESTS |
119 |
15 |
0 |
|
|
185131180 |
wsyear |
F |
Dec. 14, 2022, 12:57 a.m. |
OK |
GNU C++20 (64) |
TESTS |
119 |
15 |
0 |
|
|
185105157 |
siganai |
F |
Dec. 13, 2022, 4:56 p.m. |
OK |
GNU C++20 (64) |
TESTS |
119 |
15 |
0 |
|
|
185103894 |
siganai |
F |
Dec. 13, 2022, 4:45 p.m. |
OK |
GNU C++20 (64) |
TESTS |
119 |
15 |
102400 |
|
|
185051644 |
MridulAhi |
F |
Dec. 13, 2022, 9:03 a.m. |
OK |
GNU C++20 (64) |
TESTS |
119 |
15 |
102400 |
|
|
185044398 |
vipjml |
F |
Dec. 13, 2022, 7:48 a.m. |
OK |
GNU C++20 (64) |
TESTS |
119 |
15 |
102400 |
|
|
185043696 |
vipjml |
F |
Dec. 13, 2022, 7:41 a.m. |
OK |
GNU C++20 (64) |
TESTS |
119 |
15 |
102400 |
|
|
185126227 |
zidder |
F |
Dec. 13, 2022, 10:12 p.m. |
OK |
GNU C++20 (64) |
TESTS |
119 |
15 |
614400 |
|
|
185039854 |
lquo |
F |
Dec. 13, 2022, 7 a.m. |
OK |
GNU C++20 (64) |
TESTS |
119 |
15 |
921600 |
|
|
185031200 |
Spheniscine |
F |
Dec. 13, 2022, 4:39 a.m. |
OK |
Rust 2021 |
TESTS |
119 |
15 |
204800 |
|
|
185028733 |
Spheniscine |
F |
Dec. 13, 2022, 3:57 a.m. |
OK |
Rust 2021 |
TESTS |
119 |
15 |
204800 |
|
|
remove filters
Back to search problems