『PG2』模拟最大流

Luogu
IDLGP9902
Time500ms
Memory512MB
DifficultyP6
状压 DP
给定 $n$ 个点,$m$ 条有向边,给定每条边的容量,保证每条边 $(u,v,w)$ 满足 $v-u\in[0,k]$,求从点 $1$ 到点 $n$ 的最大流。 ## Input 第一行包含三个正整数 $n$、$m$、$k$,用空格分隔。 接下来$m$行每行包含三个正整数 $u_i$、$v_i$、$w_i$,用空格分隔,表示第 $i$ 条有向边从 $u_i$ 出发,到达 $v_i$,容量为 $w_i$。 ## Output 一个整数,表示 $1$ 到 $n$ 的最大流。 [samples] ## Note 对于 $20\%$ 的数据满足 $n\leq 10^2$,$m\leq 10^4$,$k\leq 2$。 对于 $40\%$ 的数据满足 $n\leq 10^4$,$m\leq 10^6$,$k\leq 2$。 对于 $60\%$ 的数据满足 $n\leq 8\times 10^4$,$m\leq 10^6$,$k\leq 2$。 对于 $80\%$ 的数据满足 $n\leq 8\times 10^4$,$m\leq 10^6$,$k\leq 4$。 对于 $100\%$ 的数据满足 $2\leq n\leq 8\times 10^4$,$1\leq m\leq 10^6$,$2\leq k\leq 7$,$1\leq w\leq100$。
Samples
Input #1
9 21 3
1 2 1
2 3 1
3 4 1
4 5 1
5 6 1
6 7 1
7 8 1
8 9 1
1 3 1
2 4 1
3 5 1
4 6 1
5 7 1
6 8 1
7 9 1
1 4 1
2 5 1
3 6 1
4 7 1
5 8 1
6 9 1
Output #1
3
Input #2
5 10 2
3 5 73
3 4 33
3 5 84
4 5 10
3 4 15
1 2 83
1 3 8
1 3 24
5 5 15
1 2 62
Output #2
32
API Response (JSON)
{
  "problem": {
    "name": "『PG2』模拟最大流",
    "description": {
      "content": " 给定 $n$ 个点,$m$ 条有向边,给定每条边的容量,保证每条边 $(u,v,w)$ 满足 $v-u\\in[0,k]$,求从点 $1$ 到点 $n$ 的最大流。",
      "description_type": "Markdown"
    },
    "platform": "Luogu",
    "limit": {
      "time_limit": 500,
      "memory_limit": 524288
    },
    "difficulty": {
      "LuoguStyle": "P6"
    },
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "LGP9902"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "给定 $n$ 个点,$m$ 条有向边,给定每条边的容量,保证每条边 $(u,v,w)$ 满足 $v-u\\in[0,k]$,求从点 $1$ 到点 $n$ 的最大流。\n\n## Input\n\n第一行包含三个正整数 $n$、$m$、$k$,用空格分隔。\n\n接下来$m$行每行包含三个正整数 $u_i$、$v_i$、$w_i$,用空格分隔,表示第 $i$ 条有向边从 $u_i$ 出发,到达 $v_i$,容量为...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments