結果

問題 No.1678 Coin Trade (Multiple)
ユーザー 👑 tatyamtatyam
提出日時 2021-09-10 23:03:30
言語 C++23(draft)
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 164 ms / 5,000 ms
コード長 647 bytes
コンパイル時間 4,116 ms
コンパイル使用メモリ 268,432 KB
実行使用メモリ 16,748 KB
最終ジャッジ日時 2023-09-02 20:57:33
合計ジャッジ時間 9,012 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,372 KB
testcase_01 AC 1 ms
4,368 KB
testcase_02 AC 2 ms
4,368 KB
testcase_03 AC 32 ms
9,032 KB
testcase_04 AC 89 ms
12,596 KB
testcase_05 AC 56 ms
15,496 KB
testcase_06 AC 50 ms
14,552 KB
testcase_07 AC 78 ms
10,080 KB
testcase_08 AC 58 ms
10,592 KB
testcase_09 AC 60 ms
16,060 KB
testcase_10 AC 26 ms
6,284 KB
testcase_11 AC 70 ms
12,352 KB
testcase_12 AC 24 ms
6,460 KB
testcase_13 AC 125 ms
14,840 KB
testcase_14 AC 50 ms
9,024 KB
testcase_15 AC 58 ms
12,108 KB
testcase_16 AC 32 ms
12,232 KB
testcase_17 AC 61 ms
15,168 KB
testcase_18 AC 1 ms
4,368 KB
testcase_19 AC 2 ms
4,368 KB
testcase_20 AC 1 ms
4,372 KB
testcase_21 AC 2 ms
4,368 KB
testcase_22 AC 2 ms
4,368 KB
testcase_23 AC 1 ms
4,368 KB
testcase_24 AC 1 ms
4,368 KB
testcase_25 AC 1 ms
4,368 KB
testcase_26 AC 2 ms
4,372 KB
testcase_27 AC 1 ms
4,372 KB
testcase_28 AC 2 ms
4,372 KB
testcase_29 AC 2 ms
4,368 KB
testcase_30 AC 2 ms
4,368 KB
testcase_31 AC 1 ms
4,368 KB
testcase_32 AC 1 ms
4,368 KB
testcase_33 AC 2 ms
4,372 KB
testcase_34 AC 2 ms
4,372 KB
testcase_35 AC 2 ms
4,368 KB
testcase_36 AC 2 ms
4,372 KB
testcase_37 AC 2 ms
4,368 KB
testcase_38 AC 2 ms
4,368 KB
testcase_39 AC 1 ms
4,372 KB
testcase_40 AC 2 ms
4,372 KB
testcase_41 AC 1 ms
4,368 KB
testcase_42 AC 2 ms
4,368 KB
testcase_43 AC 2 ms
4,368 KB
testcase_44 AC 2 ms
4,372 KB
testcase_45 AC 2 ms
4,368 KB
testcase_46 AC 2 ms
4,372 KB
testcase_47 AC 1 ms
4,368 KB
testcase_48 AC 163 ms
16,748 KB
testcase_49 AC 160 ms
15,708 KB
testcase_50 AC 164 ms
15,348 KB
testcase_51 AC 161 ms
16,104 KB
testcase_52 AC 158 ms
15,332 KB
testcase_53 AC 159 ms
15,468 KB
testcase_54 AC 160 ms
16,232 KB
testcase_55 AC 154 ms
15,504 KB
testcase_56 AC 156 ms
15,504 KB
testcase_57 AC 156 ms
15,276 KB
testcase_58 AC 125 ms
15,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/mincostflow>
using namespace std;
using ll = long long;

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    ll N, K;
    cin >> N >> K;
    atcoder::mcf_graph<ll, ll> g(N);
    for(ll i = 0; i < N - 1; i++) g.add_edge(i, i + 1, K, 1LL << 30);
    vector<ll> A(N);
    for(ll i = 0; i < N; i++){
        ll M;
        cin >> A[i] >> M;
        while(M--){
            ll B;
            cin >> B;
            B--;
            if(A[B] < A[i]) g.add_edge(B, i, 1, ((i - B) << 30) - (A[i] - A[B]));
        }
    }
    cout << ((K * (N - 1)) << 30) - g.flow(0, N - 1, K).second << endl;
}
0