結果

問題 No.479 頂点は要らない
ユーザー 🍮かんプリン🍮かんプリン
提出日時 2020-06-05 01:30:10
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 85 ms / 1,500 ms
コード長 865 bytes
コンパイル時間 1,368 ms
コンパイル使用メモリ 150,708 KB
実行使用メモリ 9,424 KB
最終ジャッジ日時 2023-08-20 19:22:03
合計ジャッジ時間 4,840 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 2 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 2 ms
4,384 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 3 ms
4,380 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 3 ms
4,376 KB
testcase_23 AC 2 ms
4,376 KB
testcase_24 AC 2 ms
4,376 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 83 ms
8,708 KB
testcase_27 AC 85 ms
8,980 KB
testcase_28 AC 71 ms
9,424 KB
testcase_29 AC 67 ms
6,276 KB
testcase_30 AC 66 ms
6,204 KB
testcase_31 AC 66 ms
6,292 KB
testcase_32 AC 66 ms
6,168 KB
testcase_33 AC 69 ms
6,400 KB
testcase_34 AC 74 ms
6,696 KB
testcase_35 AC 63 ms
5,112 KB
testcase_36 AC 34 ms
4,540 KB
testcase_37 AC 73 ms
6,996 KB
testcase_38 AC 60 ms
6,120 KB
testcase_39 AC 44 ms
5,680 KB
testcase_40 AC 53 ms
6,860 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2020.06.05 01:30:06
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

int main() {
    int n, m;
    cin >> n >> m;
    vector< vector< int > > g(n);
    for (int i = 0; i < m; i++) {
        int u, v;
        cin >> u >> v;
        g[u].push_back(v);
        g[v].push_back(u);
    }
    vector< bool > used(n, false);
    vector< int > ans(n, 0);
    for (int i = n - 1; i >= 0; i--) {
        if (used[i]) continue;
        used[i] = true;
        for (int v : g[i]) {
            ans[v] = 1;
            used[v] = true;
        }
    }
    bool ok = false;
    for (int i = n-1; i >= 0; i--) {
        if (ans[i] == 1) {
            cout << ans[i];
            ok = true;
        } else if (ok) {
            cout << ans[i];
        }
    }
    cout << endl;
    return 0;
}
0