結果

問題 No.479 頂点は要らない
ユーザー treeonetreeone
提出日時 2017-01-27 22:55:16
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 67 ms / 1,500 ms
コード長 835 bytes
コンパイル時間 1,308 ms
コンパイル使用メモリ 154,480 KB
実行使用メモリ 5,240 KB
最終ジャッジ日時 2023-08-25 04:29:09
合計ジャッジ時間 3,944 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,376 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 2 ms
4,376 KB
testcase_22 AC 2 ms
4,376 KB
testcase_23 AC 2 ms
4,380 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 2 ms
4,376 KB
testcase_26 AC 67 ms
5,120 KB
testcase_27 AC 67 ms
5,120 KB
testcase_28 AC 61 ms
5,104 KB
testcase_29 AC 62 ms
5,092 KB
testcase_30 AC 62 ms
5,232 KB
testcase_31 AC 63 ms
5,180 KB
testcase_32 AC 62 ms
5,176 KB
testcase_33 AC 57 ms
5,184 KB
testcase_34 AC 62 ms
5,100 KB
testcase_35 AC 62 ms
5,240 KB
testcase_36 AC 38 ms
4,376 KB
testcase_37 AC 60 ms
5,096 KB
testcase_38 AC 52 ms
5,096 KB
testcase_39 AC 36 ms
4,376 KB
testcase_40 AC 42 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
using namespace std;
typedef pair<int, int> P;

signed main(){
    int n, m;
    cin >> n >> m;
    vector<bool> f(n, false);
    vector<P> d;
    rep(i, 0, m){
        int a, b;
        cin >> a >> b;
        if(a < b) swap(a, b);
        d. push_back(P(a, b));
    }
    sort(all(d));
    reverse(all(d));
    rep(i, 0, d.size()){
        if(f[d[i].first] || f[d[i].second]) continue;
        f[d[i].second] = true;
    }
    string s = "";
    repb(i, n - 1, 0){
        if(s == "" && f[i] == false) continue;
        else{
            if(f[i]) s += "1";
            else s += "0";
        }
    }
    cout << s << endl;
}
0