Search is not available for this dataset
name stringlengths 2 88 | description stringlengths 31 8.62k | public_tests dict | private_tests dict | solution_type stringclasses 2
values | programming_language stringclasses 5
values | solution stringlengths 1 983k |
|---|---|---|---|---|---|---|
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
struct edge {
int to;
int cap;
int cost;
int rev;
edge() {}
edge(int to, int cap, int cost, int rev)
: to(to), cap(cap), cost(cost), rev(rev) {}
};
int V;
vector<edge> G[100000];
int dist[100000];
int prevv[100000], preve[100000];
void add_edge(int from, i... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void output(T a, int p) {
if (p)
cout << fixed << setprecision(p) << a << "\n";
else
cout << a << "\n";
}
struct node {
int cost, pos;
};
struct edge {
int to, cap, cost, rev;
};
bool operator<(const node &a, const node &b) { ret... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
using LL = long long;
constexpr LL LINF = 334ll << 53;
constexpr int INF = 15 << 26;
constexpr LL MOD = 1E9 + 7;
class MinimumCostFlow {
struct Edge {
int to;
long long cost, capacity;
int rev_id;
Edge(int to, long long cost, long long cap, int id)
... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
namespace MCF {
const int MAXN = 120;
const int MAXM = 2100;
int to[MAXM];
int next[MAXM];
int first[MAXN];
int c[MAXM];
long long w[MAXM];
long long pot[MAXN];
int rev[MAXM];
long long ijk[MAXN];
int v[MAXN];
long long toc;
int tof;
int n;
int m;
void init(int _n) {
n = ... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int INFL = (int)1e9;
const long long int INFLL = (long long int)1e18;
const double INFD = numeric_limits<double>::infinity();
const double PI = 3.14159265358979323846;
bool nearlyeq(double x, double y) { return abs(x - y) < 1e-9; }
bool inrange(int x, int t) { return ... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int maxN = 1100;
bool mark[maxN];
int parentEdge[maxN], dis[maxN];
int n, k, m, st, fn, F, remFlow;
struct edge {
int u, v, weight, cap;
};
vector<int> g[maxN];
edge e[maxN * maxN];
int curID = 0;
edge make_edge(int u, int v, int w, int cap) {
edge e;
e.u = u;
... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
constexpr int INF = 1000000001;
constexpr int MAX = 10000;
struct Edge {
int to;
int cap;
int cost;
int rev;
Edge(int to, int cap, int cost, int rev)
: to(to), cap(cap), cost(cost), rev(rev) {}
};
int V, E, F;
vector<Edge> G[MAX];
int h[MAX];
int dist[MAX];
... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long LINF = 334ll << 53;
const int INF = 15 << 26;
const long long MOD = 1E9 + 7;
struct Edge {
int from, to;
long long cost, capacity;
};
typedef vector<unordered_map<int, long long>> Flow;
bool dijkstra(const int start, const vector<unordered_map<int, Edge>... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
struct Edge {
int src, dst;
int capacity, cost;
Edge(int src, int dst, int capacity, int cost)
: src(src), dst(dst), capacity(capacity), cost(cost) {}
};
bool operator<(const Edge &e, const Edge &f) {
return e.cost != f.cost ? e.cost > f.cost
... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int maxN = 1100;
bool mark[maxN];
int parentEdge[maxN], dis[maxN];
int n, k, m, st, fn, F, remFlow;
struct edge {
int u, v, weight, cap;
};
vector<int> g[maxN];
edge e[maxN * maxN];
int curID = 0;
edge make_edge(int u, int v, int w, int cap) {
edge e;
e.u = u;
... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int maxn = 105;
struct Edge {
int from, to, cap, flow, cost;
Edge(int u, int v, int c, int f, int w)
: from(u), to(v), cap(c), flow(f), cost(w) {}
};
int n, m, tf;
vector<Edge> edges;
vector<int> G[maxn];
bool inq[maxn];
int d[max... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
using i64 = long long;
struct edge {
i64 from;
i64 to;
i64 cap;
i64 cost;
i64 rev;
};
i64 INF = 1e8;
i64 capacity_scaling_bflow(std::vector<std::vector<edge>>& g,
std::vector<i64> b) {
i64 ans = 0;
i64 U = *std::max_element(begin(b),... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int maxN = 1100;
bool mark[maxN];
int parentEdge[maxN], dis[maxN];
int n, k, m, st, fn, F, remFlow;
struct edge {
int u, v, weight, cap;
};
vector<int> g[maxN];
edge e[maxN * maxN];
int curID = 0;
edge make_edge(int u, int v, int w, int cap) {
edge e;
e.u = u;
... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
using T = int;
using U = int;
T INF = numeric_limits<T>::max();
struct edge {
int to, rev;
T cost;
U cap;
edge(int to, U cap, int rev, T cost)
: to(to), rev(rev), cost(cost), cap(cap) {}
};
struct primal_dual {
int N;
vector<vector<edg... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | class PQueue
attr_accessor :node
def initialize
@node = []
end
def insert(num)
i = @node.size
@node[i] = num
down_heap(i)
end
def extract
ret = @node[0]
if @node.size > 1
@node[0] = @node.pop()
up_heap(0)
else
@node = []
end
return ret
end
def delete... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
struct edge {
int to, cap, cost, rev;
};
int V;
vector<edge> G[10000];
int h[10000];
int dist[10000];
int prevv[10000], preve[10000];
void init_edge() {
for (int i = 0; i < V; i++) G[i].clear();
}
void add_edge(int from, int to, int cap, int cost) {
G[from].push_back(... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x) cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("avx")
using namespace std;
template <typename T1, typename T2>
ostream& operator<<(ostream& o, const pair<T1, T2> p) {
o << "(" << p.first << ":" << p.second << ")";
return o;
}
template <typename iterator>
inline size_t argmin(iterator begin, ... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
struct Edge {
int to, cap, cost, rev;
Edge(int to, int cap, int cost, int rev)
: to(to), cap(cap), cost(cost), rev(rev) {}
};
vector<int> dist;
bool bellman_ford(vector<vector<Edge>>& Graph, int s, int t,
vector<int>& parent_v, vector<int>& paren... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
typedef int T;
typedef int U;
T INF = numeric_limits<T>::max();
struct edge {
int to, rev;
T cost;
U cap;
edge(int to, U cap, int rev, T cost)
: to(to), rev(rev), cost(cost), cap(cap) {}
};
struct primal_dual {
int N;
vector<vector<edge> > graph;
vector<... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("avx")
using namespace std;
template <typename T1, typename T2>
ostream& operator<<(ostream& o, const pair<T1, T2> p) {
o << "(" << p.first << ":" << p.second << ")";
return o;
}
template <typename iterator>
inline size_t argmin(iterator begin, ... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
struct node {
int id;
int cap;
int cost;
struct node *next;
};
struct node **list;
int **flow, *delta, *dist, *prev;
int *heap, *heap_index, heapsize;
void Insert(int, int, int, int);
void downheap(int);
void upheap(int);
void PQ_init(int);
int PQ_remove(void);
void PQ_update(int);
int ... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
struct edge {
int to, cap, cost, rev;
};
int V;
vector<edge> G[100];
vector<int> h(100);
int dist[100];
int prevv[100], preve[100];
void add_edge(int from, int to, int cap, int cost) {
G[from].push_back((edge){to, cap, cost, (int)G[to].size()});
G[to].push_back((edge)... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
const int N = 110;
const int M = 2010;
const int inf = 0x3fffffff;
struct Edge {
int to, cap, cost, next;
} es[M];
int S, T;
int SIZE = 0;
int h[N];
int dist[N], queue[N * N], inq[N];
int vis[N];
void add(int u, int v, int cap, int cost) {
int i = SIZE++;
es[i].to = v;
es[i].cap = cap;
... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long INF = (1ll << 60);
struct Edge {
long long s, t, c, d, u;
};
long long minCostFlow(vector<vector<Edge>> &G, long long s, long long t,
long long F) {
long long V = G.size();
long long cost = 0;
while (F) {
vector<long long> d... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
using i64 = long long;
struct edge {
i64 from;
i64 to;
i64 cap;
i64 cost;
i64 rev;
};
i64 INF = 1e8;
i64 capacity_scaling_bflow(std::vector<std::vector<edge>>& g,
std::vector<i64> b) {
i64 ans = 0;
i64 U = *std::max_element(begin(b),... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import sys
import csv
import argparse
import time
import heapq
INF = sys.maxint/3
class Edge:
def __init__(self, to, cap, cost, rev):
self.to = to
self.cap = cap
self.cost = cost
self.rev =... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
using i64 = long long;
struct edge {
i64 from;
i64 to;
i64 cap;
i64 cost;
i64 rev;
};
i64 INF = 1e8;
i64 capacity_scaling_bflow(std::vector<std::vector<edge>>& g,
std::vector<i64> b) {
i64 ans = 0;
i64 U = *std::max_element(begin(b),... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
#define FOR(i,a,b) for(int i= (a); i<((int)b); ++i)
#define RFOR(i,a) for(int i=(a); i >= 0; --i)
#define FOE(i,a) for(auto i : a)
#define ALL(c) (c).begin(), (c).end()
#define RALL(c) (c).rbegin(), (c).rend()
#define DUMP(x) cerr << #x << " = " << (x) << endl;
#define SUM(x) std::accumulate(... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("avx")
using namespace std;
template <typename T1, typename T2>
ostream& operator<<(ostream& o, const pair<T1, T2> p) {
o << "(" << p.first << ":" << p.second << ")";
return o;
}
template <typename iterator>
inline size_t argmin(iterator begin, ... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | 4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
|
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
using T = int;
using U = int;
T INF = numeric_limits<T>::max();
struct edge {
int to, rev;
T cost;
U cap;
edge(int to, U cap, int rev, T cost)
: to(to), rev(rev), cost(cost), cap(cap) {}
};
struct primal_dual {
int N;
vector<vector<edge> > graph;
vector<... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | a
|
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int maxN = 1100;
bool mark[maxN];
int parentEdge[maxN], dis[maxN];
int n, k, m, st, fn, F, remFlow;
struct edge {
int u, v, weight, cap;
};
vector<int> g[maxN];
edge e[maxN * maxN];
int curID = 0;
edge make_edge(int u, int v, int w, int cap) {
edge e;
e.u = u;
... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
os << "sz=" << v.size() << "\n[";
for (const auto& p : v) {
os << p << ",";
}
os << "]\n";
return os;
}
template <typename S, typename T>... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | python3 | from heapq import heappop, heappush
def trace(source, edge_trace):
v = source
for i in edge_trace:
e = edges[v][i]
yield e
v = e[1]
def min_cost_flow(source, sink, required_flow):
res = 0
while required_flow:
visited = set()
queue = [(0, source, tuple())]
... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | class MinimumCostFlow {
struct Edge {
int to;
long long cost, capacity;
int rev_id;
Edge(int to, long long cost, long long cap, int id)
: to(to), cost(cost), capacity(cap), rev_id(id){};
Edge() { Edge(0, 0, 0, 0); }
};
struct Prev {
LL cost;
int from, id;
};
using Graph = v... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long int E = 1e18 + 7;
const long long int MOD = 1000000007;
class CFlow {
private:
struct edge {
long long int to;
long long int cap;
long long int rev;
long long int cost;
};
struct node {
long long int cost;
long long int flow;
... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
struct Edge {
int to, cap, cost, rev;
Edge(int to, int cap, int cost, int rev)
: to(to), cap(cap), cost(cost), rev(rev) {}
};
vector<int> dist;
bool bellman_ford(vector<vector<Edge>>& Graph, int s, int t,
vector<int>& parent_v, vector<int>& paren... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("avx")
using namespace std;
template <typename T1, typename T2>
ostream& operator<<(ostream& o, const pair<T1, T2> p) {
o << "(" << p.first << ":" << p.second << ")";
return o;
}
template <typename iterator>
inline size_t argmin(iterator begin, ... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | java | import java.util.*;
import java.io.*;
import java.awt.geom.*;
import java.math.*;
public class Main {
static final Scanner in = new Scanner(System.in);
static final PrintWriter out = new PrintWriter(System.out,false);
static boolean debug = false;
static int primalDual(int[][][] cost, int[][][] capacity, int sou... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | import sys
import heapq
INF = sys.maxint/3
class Edge:
def __init__(self, to, cap, cost, rev):
self.to = to
self.cap = cap
self.cost = cost
self.rev = rev
def print_attributes(self):
print "to: {0}, cap: {1}, cost: {2}, rev: {3}".format(self.to, self.cap, self.cost, se... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int VMAX = 100;
struct Edge {
int from, to, flow, cost, rev;
Edge(int from, int to, int flow, int cost, int rev) {
this->from = from;
this->to = to;
this->flow = flow;
this->cost = cost;
this->rev = rev;
}
};
void add_edge(vector<vector<Edge>... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
inline int get_c(void) {
static char buf[1024];
static char *head = buf + 1024;
static char *tail = buf + 1024;
if (head == tail) fread(head = buf, 1, 1024, stdin);
return *head++;
}
inline int get_i(void) {
register int ret = 0;
register int neg = false;
register int bit = get_... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int inf = 0xfffffff;
struct edge {
int to, cap, cost, rev;
};
int v;
vector<edge> G[105];
int dist[105], prevv[105], preve[105];
void add_edge(int from, int to, int cap, int cost) {
G[from].push_back((edge){to, cap, cost, (int)G[to].size()});
G[to].push_back((ed... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int maxN = 1100;
bool mark[maxN];
int parentEdge[maxN], dis[maxN];
int n, k, m, st, fn, F, remFlow;
struct edge {
int u, v, weight, cap;
};
vector<int> g[maxN];
edge e[maxN * maxN];
int curID = 0;
edge make_edge(int u, int v, int w, int cap) {
edge e;
e.u = u;
... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | fn main() {
let s = std::io::stdin();
let mut sc = Scanner { reader: s.lock() };
let v: usize = sc.read();
let e: usize = sc.read();
let f: i64 = sc.read();
let mut solver = primal_dual::MinimumCostFlowSolver::new(v);
for _ in 0..e {
let u: usize = sc.read();
let v: usize = ... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
#pragma GCC diagnostic ignored "-Wsign-compare"
#pragma GCC diagnostic ignored "-Wconversion"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) {
os << "sz=" << v.size() << ... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | java | import java.io.*;
import java.util.*;
public class Main implements Runnable{
private ArrayList<ArrayList<Integer>> graph;
private Edge[] edges;
public static void main(String[] args) throws Exception {
new Thread(null, new Main(), "bridge", 16 * 1024 * 1024).start();
}
@Override
public... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
namespace MCF {
const int MAXN = 120;
const int MAXM = 2100;
int to[MAXM];
int next[MAXM];
int first[MAXN];
int c[MAXM];
long long w[MAXM];
long long pot[MAXN];
int rev[MAXM];
long long ijk[MAXN];
int v[MAXN];
long long toc;
int tof;
int n;
int m;
void init(int _n) {
n = ... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | java | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.Closeable;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
impo... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
using namespace std;
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = std::vector<std::vector<T>>;
template <typename T>
using VVV = std::vector<std::vector<std::vector<T>>>;
template <class T>
inline T ceil(T a, T b) {
return (a + b - 1) / b;
}
template <class T>
inline void print... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include<iostream>
#include<vector>
#define INF 99999999
using namespace std;
const int MAX_V = 100;
struct edge{
int to,cap,cost,rev; //?????????,??????,?????¨,??????
};
vector<edge> G[MAX_V];
void add_edge(int from,int to,int cap,int cost){
G[from].push_back((edge){to,cap,cost,G[to].size()});
G[to].push_back... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
using i64 = long long;
struct edge {
i64 from;
i64 to;
i64 cap;
i64 cost;
i64 rev;
};
i64 INF = 1e8;
i64 capacity_scaling_bflow(std::vector<std::vector<edge>>& g,
std::vector<i64> b) {
i64 ans = 0;
i64 U = *std::max_element(begin(b),... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = std::vector<std::vector<T>>;
template <typename T>
using VVV = std::vector<std::vector<std::vector<T>>>;
template <class T>
inline T ceil(T a, T b) {
return (a + b - 1) / b;
}
template <class T>
inline void print... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 29;
const long long INF = 1ll << 50;
const double pi = acos(-1);
const double eps = 1e-8;
const long long mod = 1e9 + 7;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
class Network {
private:
int V;
struct edge {
int to, cap, cost, re... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long int E = 1e18 + 7;
const long long int MOD = 1000000007;
class CFlow {
private:
struct edge {
long long int to;
long long int cap;
long long int rev;
long long int cost;
};
struct node {
long long int cost;
long long int flow;
... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("avx")
using namespace std;
template <typename T1, typename T2>
ostream& operator<<(ostream& o, const pair<T1, T2> p) {
o << "(" << p.first << ":" << p.second << ")";
return o;
}
template <typename iterator>
inline size_t argmin(iterator begin, ... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
const int N = 110;
const int M = 2010;
const int inf = 0x3fffffff;
struct Edge {
int to, cap, cost, next;
} es[M];
int S, T;
int SIZE = 0;
int h[N];
int dist[N], queue[N * N], inq[N];
int vis[N];
void add(int u, int v, int cap, int cost) {
int i = SIZE++;
es[i].to = v;
es[i].cap = cap;
... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
struct node {
int id;
int cap;
int cost;
struct node *next;
};
struct node **list;
int **flow, *delta, *dist, *prev;
int *heap, *heap_index, heapsize;
void Insert(int, int, int, int);
void downheap(int);
void upheap(int);
void PQ_init(int);
int PQ_remove(void);
void PQ_update(int);
int ... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
namespace MCF {
const int MAXN = 120;
const int MAXM = 2100;
int to[MAXM];
int next[MAXM];
int first[MAXN];
int c[MAXM];
long long w[MAXM];
long long pot[MAXN];
int rev[MAXM];
long long ijk[MAXN];
int v[MAXN];
long long toc;
int tof;
int n;
int m;
void init(int _n) {
n = ... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
namespace loquat {
using vertex_t = size_t;
}
namespace loquat {
namespace edge_param {
struct to_ {
vertex_t to;
explicit to_(vertex_t t = 0) : to(t) {}
};
template <typename T>
struct weight_ {
using weight_type = T;
weight_type weight;
explicit weight_(const weight_type& w = weight... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int maxn = 105;
struct edge {
int to, cap, cost, rev;
};
int n, m, k;
int d[maxn];
int a[maxn];
int p1[maxn];
int p2[maxn];
bool inq[maxn];
vector<edge> G[maxn];
void add_edge(int u, int v, int c, int w) {
G[u].push_back(edge{v, c, w, i... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
template <class T>
struct PrimalDual {
struct Edge {
int to, rev;
T cap, cost;
Edge() {}
Edge(int _to, T _cap, T _cost, int _rev)
: to(_to), cap(_cap), cost(_cost), rev(_rev) {}
};
const T INF = numeric_limits<T>::max() / 2;
int N;
vector<v... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
class Edge {
public:
int from;
int to;
int flow;
Edge(int f, int t, int d) {
from = f;
to = t;
flow = d;
}
};
class Shortest_path_result {
public:
int sum_of_cost;
vector<int> path;
vector<int> distance;
vector<int> predecessor;
Shortest_pa... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const int maxN = 1100;
bool mark[maxN];
int parentEdge[maxN], dis[maxN];
int n, k, m, st, fn, F, remFlow;
struct edge {
int u, v, weight, cap;
};
vector<int> g[maxN];
edge e[maxN * maxN];
int curID = 0;
edge make_edge(int u, int v, int w, int cap) {
edge e;
e.u = u;
... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
class Networkflow {
private:
struct edgedata {
int from, to, capacity, weight;
edgedata* dual_p;
bool operator<(const edgedata& another) const {
return (weight != another.weight ? weight < another.weight
: capacity... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | python2 | # -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import sys
import csv
import argparse
import time
import heapq
INF = sys.maxint/3
class Edge:
def __init__(self, to, cap, cost, rev):
self.to = to
self.cap = cap
self.cost =... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void output(T a, int p) {
if (p)
cout << fixed << setprecision(p) << a << "\n";
else
cout << a << "\n";
}
struct node {
int cost, pos;
};
struct edge {
int to, cap, cost, rev;
};
bool operator<(const node &a, const node &b) { ret... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
class Edge {
public:
int from;
int to;
int flow;
Edge(int f, int t, int d) {
from = f;
to = t;
flow = d;
}
};
class Shortest_path_result {
public:
int sum_of_cost;
vector<int> path;
vector<int> distance;
vector<int> predecessor;
Shortest_pa... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
constexpr int INF = 1e9;
struct Edge {
int to, cap, rev, weight;
Edge(int t, int c, int r, int w) : to(t), cap(c), rev(r), weight(w) {}
};
using Edges = vector<Edge>;
using Graph = vector<Edges>;
class Flow {
public:
Flow(int v) {
mGraph.resize(v);
mUsed.assi... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
class Edge {
public:
int from;
int to;
int flow;
Edge(int f, int t, int d) {
from = f;
to = t;
flow = d;
}
};
class Shortest_path_result {
public:
int sum_of_cost;
vector<int> path;
vector<int> distance;
vector<int> predecessor;
Shortest_pa... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | class PQueue
attr_accessor :node
def initialize
@node = []
end
def insert(num)
i = @node.size
@node[i] = num
down_heap(i)
end
def extract
ret = @node[0]
if @node.size > 1
@node[0] = @node.pop()
up_heap(0)
else
@node = []
end
return ret
end
def delete... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
#define pb push_back
using namespace std;
const int INF=0x3f3f3f3f;
const int maxn=105;
const int maxq=1005;
struct edge{int to,cap,cost,rev;};
int n,m,k;
int d[maxn];
int a[maxn];
int p1[maxn];
int p2[maxn];
bool inq[maxn];
vector<edge>G[maxn];
void add_edge(int u,int v,int c,int w) {
G[u]... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
using i64 = int64_t;
const int INF = 1LL << 29;
struct edge {
int to, cap, rev, cost;
edge(int a, int b, int c, int d) : to(a), cap(b), rev(c), cost(d) {}
};
int V, E, F;
vector<edge> graph[100];
int min_cost_flow(int s, int g, int f) {
vector<int> min_dist(V, INF);
... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | '''
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import pandas as pd
import csv
import argparse
import time
'''
import sys
import heapq
INF = sys.maxint/3
class Edge:
def __init__(self, to, cap, cost, rev):
self.to = to
self.cap = cap
self.cost = cost
se... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
struct min_cost_flow_graph {
struct edge {
int from, to;
T cap, f;
U cost;
};
vector<edge> edges;
vector<vector<int>> g;
int n, st, fin;
T required_flow, flow;
U cost;
min_cost_flow_graph(int n, int st, int fin, ... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
int main() {
int a, b;
scanf("%d%d", &a, &b);
printf("d\n", a + b);
}
|
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | python3 | from heapq import heappop, heappush
def trace(source, edge_trace):
v = source
for i in edge_trace:
e = edges[v][i]
yield e
v = e[1]
def min_cost_flow(source, sink, required_flow):
res = 0
while required_flow:
dist = [-1] * n
queue = [(0, source, tuple())]
... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | java | import java.awt.geom.Point2D;
import java.io.*;
import java.math.BigInteger;
import java.util.*;
public class Main {
Scanner sc = new Scanner(System.in);
public static void main(String[] args){
new Main();
}
public Main(){
// new A().doIt();
new GRL_6().doIt();
}
class GRL_6{
void doIt(){
int n = sc.ne... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | java | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.Closeable;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
impo... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
template <typename T>
using V = std::vector<T>;
template <typename T>
using VV = std::vector<std::vector<T>>;
template <typename T>
using VVV = std::vector<std::vector<std::vector<T>>>;
template <class T>
inline T ceil(T a, T b) {
return (a + b - 1) / b;
}
template <class T>
inline void print... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define P pair<ll,ll>
#define FOR(I,A,B) for(ll I = (A); I < (B); ++I)
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin()) //ai>=v x is sorted
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin()) //ai>v x is sorted
#define NUM(x,... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | java | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.Closeable;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
impo... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
int v, e;
vector<pair<int, int> > adj[110], revadj[110];
int capacity[1010], cost[1010], flowingthrough[1010], dis[110], pre[110],
preedge[110], endofedge[1010];
void bellmanford() {
fill_n(dis, v, 1e9);
dis[0] = 0;
for (int f = 0; f < v; f++) {
for (int i = 0... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using Int = int64_t;
using UInt = uint64_t;
using C = std::complex<double>;
template <typename T>
using RQ = std::priority_queue<T, std::vector<T>, std::greater<T>>;
int main() {
Int v, e, f;
std::cin >> v >> e >> f;
std::vector<Int> ss(e + 1), ts(e + 1), cs(e + 1), fs(e + 1), bs(e + 1);
... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
using i64 = long long;
struct edge {
i64 from;
i64 to;
i64 cap;
i64 cost;
i64 rev;
};
i64 INF = 1e8;
i64 capacity_scaling_bflow(std::vector<std::vector<edge>>& g,
std::vector<i64> b) {
i64 ans = 0;
i64 U = *std::max_element(begin(b),... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
struct node {
int id;
int cap;
int cost;
struct node *next;
};
struct node **list;
int **flow, *dist, *prev, *preve, *h;
int *heap, *heap_index, heapsize;
void Insert(int, int, int, int);
void downheap(int);
void upheap(int);
void PQ_init(int);
int PQ_remove(void);
void PQ_update(int);
... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
using Weight = long long;
static const Weight INF = 1LL << 57;
template <class T>
using gp_queue = priority_queue<T, deque<T>, less<T>>;
struct Arc {
size_t src, dst;
Weight capacity, cost, flow;
size_t rev;
Arc() {}
Arc(size_t src, size_t dst, Weight capacity, We... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | python3 | from collections import defaultdict
v_num, e_num, flow = (int(n) for n in input().split(" "))
edges = defaultdict(list)
for _ in range(e_num):
s1, t1, cap, cost = (int(n) for n in input().split(" "))
edges[s1].append([t1, cap, cost, len(edges[t1])])
edges[t1].append([s1, cap, cost, len(edges[s1]) - 1])
ans... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long int E = 1e18 + 7;
const long long int MOD = 1000000007;
class CFlow {
private:
struct edge {
long long int to;
long long int cap;
long long int rev;
long long int cost;
};
struct node {
long long int cost;
long long int flow;
... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
struct edge {
int to, cap, cost, rev;
};
int V;
vector<edge> G[100];
vector<int> h(100);
int dist[100];
int prevv[100], preve[100];
void add_edge(int from, int to, int cap, int cost) {
G[from].push_back((edge){to, cap, cost, (int)G[to].size()});
G[to].push_back((edge)... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
void _main();
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
_main();
}
template <int NV, class V>
struct MinCostFlow {
struct edge {
int to, capacity;
V cost;
int reve;
edge(int a, int b, V c, int d) {
to = a;
capacity = b;
... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
const long long int INF = 2000000000;
struct edge {
int to, cap, cost, rev;
edge(int t, int ca, int co, int re) {
to = t;
cap = ca;
cost = co;
rev = re;
}
};
vector<edge> G[40];
int prv[40], pre[40], d[40];
int v, e, flow;
void addedge(int from, int to... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
struct edge {
int to, cap, cost, rev;
};
int V;
vector<edge> G[10000];
int h[10000];
int dist[10000];
int prevv[10000], preve[10000];
void init_edge() {
for (int i = 0; i < V; i++) G[i].clear();
}
void add_edge(int from, int to, int cap, int cost) {
G[from].push_back(... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | UNKNOWN | #include <bits/stdc++.h>
struct node {
int id;
int cap;
int cost;
struct node *next;
};
struct node **list;
int **flow, *dist, *prev, *preve, *h;
int *heap, *heap_index, heapsize;
void Insert(int, int, int, int);
void downheap(int);
void upheap(int);
void PQ_init(int);
int PQ_remove(void);
void PQ_update(int);
... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | cpp | #include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void output(T a, int p) {
if (p)
cout << fixed << setprecision(p) << a << "\n";
else
cout << a << "\n";
}
struct node {
int cost, pos;
};
struct edge {
int to, cap, cost, rev;
};
bool operator<(const node &a, const node &b) { ret... |
p02377 Minimum Cost Flow | Examples
Input
4 5 2
0 1 2 1
0 2 1 2
1 2 1 1
1 3 1 3
2 3 2 1
Output
6
Input
Output | {
"input": [
"4 5 2\n0 1 2 1\n0 2 1 2\n1 2 1 1\n1 3 1 3\n2 3 2 1",
""
],
"output": [
"6",
""
]
} | {
"input": [],
"output": []
} | IN-CORRECT | java | import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.Closeable;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
impo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.