結果

問題 No.479 頂点は要らない
ユーザー PachicobuePachicobue
提出日時 2017-03-14 19:50:52
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 500 ms / 1,500 ms
コード長 1,909 bytes
コンパイル時間 818 ms
コンパイル使用メモリ 63,920 KB
実行使用メモリ 8,972 KB
最終ジャッジ日時 2023-09-12 12:22:12
合計ジャッジ時間 4,196 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,668 KB
testcase_01 AC 3 ms
5,784 KB
testcase_02 AC 3 ms
5,720 KB
testcase_03 AC 3 ms
5,808 KB
testcase_04 AC 3 ms
5,660 KB
testcase_05 AC 3 ms
5,828 KB
testcase_06 AC 3 ms
5,696 KB
testcase_07 AC 4 ms
5,660 KB
testcase_08 AC 3 ms
5,792 KB
testcase_09 AC 4 ms
5,716 KB
testcase_10 AC 4 ms
5,664 KB
testcase_11 AC 3 ms
5,732 KB
testcase_12 AC 3 ms
5,768 KB
testcase_13 AC 3 ms
5,756 KB
testcase_14 AC 3 ms
5,900 KB
testcase_15 AC 3 ms
5,764 KB
testcase_16 AC 4 ms
5,700 KB
testcase_17 AC 3 ms
5,696 KB
testcase_18 AC 3 ms
5,664 KB
testcase_19 AC 4 ms
5,860 KB
testcase_20 AC 4 ms
5,772 KB
testcase_21 AC 4 ms
5,792 KB
testcase_22 AC 4 ms
5,824 KB
testcase_23 AC 4 ms
5,724 KB
testcase_24 AC 4 ms
5,696 KB
testcase_25 AC 4 ms
5,704 KB
testcase_26 AC 88 ms
8,920 KB
testcase_27 AC 86 ms
8,880 KB
testcase_28 AC 500 ms
8,972 KB
testcase_29 AC 70 ms
7,572 KB
testcase_30 AC 70 ms
7,560 KB
testcase_31 AC 70 ms
7,564 KB
testcase_32 AC 69 ms
7,568 KB
testcase_33 AC 71 ms
7,796 KB
testcase_34 AC 78 ms
7,884 KB
testcase_35 AC 67 ms
7,628 KB
testcase_36 AC 37 ms
6,564 KB
testcase_37 AC 77 ms
7,976 KB
testcase_38 AC 64 ms
7,588 KB
testcase_39 AC 47 ms
7,172 KB
testcase_40 AC 56 ms
7,756 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// clang-format off
#include <cassert>
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>

#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (b)-1; i >= (a); i--)
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i,n) for(int i = 1; i <= (n); i++)
#define rrep(i, n) for(int i = (n)-1; i >= 0; i--)

#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define pii pair<int, int>
#define vi vector<int>

using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T>& p){return o<<"("<<p.first<<","<<p.second<<")";}
template<class T> ostream& operator<<(ostream& o,const vector<T>& vc){o<<"sz = "<<vc.size()<<endl<<"[";for(const T& v:vc) o<<v<<",";o<<"]";return o;}
typedef long long ll;

int n,m;
#define MAX 100000
vector<int> g[MAX];
bool bits[MAX];

void reduct(int sup)
{
    auto it = g[sup].begin();
    while(it != g[sup].end()){
        const int e = *it;
        if(e < sup){
            bits[e] = true;
            g[sup].erase(it);
            auto ite = g[e].begin();
            while(ite != g[e].end()){
                const int e2 = *ite;
                if(e2 < e){
                    g[e].erase(ite);
                } else {
                    ite++;
                }
            }
        } else {
            it++;
        }
    }
}

int main()
{
    cin >> n >> m;
    rep(i, m){
        int a_,b_;
        cin >> a_ >> b_;
        g[a_].pb(b_);
        g[b_].pb(a_);
    }

    rrep(i,n){
        reduct(i);
    }

    bool f = false;
    rrep(i,n){
        if(bits[i]){
            cout << 1;
            f = true;
        } else {
            if(f){
                cout << 0;
            }
        }
    }
    cout << endl;
    return 0;
}
0