結果

問題 No.1640 簡単な色塗り
ユーザー trineutrontrineutron
提出日時 2021-08-06 23:37:03
言語 C++23(draft)
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 793 bytes
コンパイル時間 3,661 ms
コンパイル使用メモリ 259,608 KB
実行使用メモリ 47,424 KB
最終ジャッジ日時 2023-09-12 03:22:28
合計ジャッジ時間 18,241 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 251 ms
35,384 KB
testcase_05 AC 250 ms
34,908 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 318 ms
21,120 KB
testcase_11 AC 231 ms
19,132 KB
testcase_12 AC 193 ms
17,652 KB
testcase_13 AC 589 ms
32,836 KB
testcase_14 AC 552 ms
32,612 KB
testcase_15 AC 127 ms
12,348 KB
testcase_16 AC 165 ms
17,484 KB
testcase_17 AC 458 ms
36,224 KB
testcase_18 AC 22 ms
5,276 KB
testcase_19 AC 182 ms
17,896 KB
testcase_20 AC 301 ms
21,384 KB
testcase_21 AC 219 ms
18,568 KB
testcase_22 AC 15 ms
4,932 KB
testcase_23 AC 316 ms
22,108 KB
testcase_24 AC 62 ms
10,136 KB
testcase_25 AC 190 ms
18,468 KB
testcase_26 AC 386 ms
34,400 KB
testcase_27 AC 117 ms
12,096 KB
testcase_28 AC 572 ms
31,760 KB
testcase_29 AC 420 ms
32,692 KB
testcase_30 AC 57 ms
7,668 KB
testcase_31 TLE -
testcase_32 TLE -
testcase_33 AC 847 ms
20,784 KB
testcase_34 AC 1,482 ms
26,516 KB
testcase_35 AC 909 ms
22,832 KB
testcase_36 AC 54 ms
7,620 KB
testcase_37 AC 91 ms
9,756 KB
testcase_38 TLE -
testcase_39 AC 240 ms
14,884 KB
testcase_40 AC 265 ms
15,192 KB
testcase_41 AC 1,570 ms
29,056 KB
testcase_42 AC 436 ms
18,032 KB
testcase_43 AC 511 ms
20,308 KB
testcase_44 AC 407 ms
18,836 KB
testcase_45 AC 219 ms
16,496 KB
testcase_46 AC 67 ms
8,716 KB
testcase_47 AC 34 ms
6,384 KB
testcase_48 TLE -
testcase_49 AC 11 ms
4,684 KB
testcase_50 AC 2 ms
4,376 KB
testcase_51 AC 1 ms
4,380 KB
testcase_52 TLE -
testcase_53 -- -
07_evil_01.txt -- -
07_evil_02.txt -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/maxflow>

using namespace std;
using namespace atcoder;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n), b(n);
    for (int i = 0; i < n; i++)
    {
        cin >> a.at(i) >> b.at(i);
        a.at(i)--;
        b.at(i)--;
    }
    mf_graph<int> flow(2 * n + 2);
    for (int i = 0; i < n; i++)
    {
        flow.add_edge(2 * n, i, 1);
        flow.add_edge(i, a.at(i) + n, 1);
        flow.add_edge(i, b.at(i) + n, 1);
        flow.add_edge(i + n, 2 * n + 1, 1);
    }
    if (flow.flow(2 * n, 2 * n + 1) < n)
    {
        puts("No");
        return 0;
    }
    puts("Yes");
    for (auto &&e : flow.edges())
    {
        if (e.from < n and e.flow)
        {
            cout << e.to - n + 1 << endl;
        }
    }
    return 0;
}
0