結果

問題 No.479 頂点は要らない
ユーザー rapurasurapurasu
提出日時 2017-03-10 15:45:50
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,418 bytes
コンパイル時間 1,536 ms
コンパイル使用メモリ 168,932 KB
実行使用メモリ 14,868 KB
最終ジャッジ日時 2023-09-06 13:16:19
合計ジャッジ時間 5,736 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
8,188 KB
testcase_01 AC 4 ms
8,276 KB
testcase_02 AC 3 ms
8,280 KB
testcase_03 AC 4 ms
8,192 KB
testcase_04 WA -
testcase_05 AC 4 ms
8,240 KB
testcase_06 AC 3 ms
8,304 KB
testcase_07 AC 3 ms
8,200 KB
testcase_08 AC 4 ms
8,220 KB
testcase_09 AC 4 ms
8,312 KB
testcase_10 AC 3 ms
8,252 KB
testcase_11 AC 3 ms
8,260 KB
testcase_12 WA -
testcase_13 AC 4 ms
8,204 KB
testcase_14 AC 4 ms
8,256 KB
testcase_15 AC 4 ms
8,212 KB
testcase_16 AC 4 ms
8,220 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 5 ms
8,280 KB
testcase_21 AC 4 ms
8,240 KB
testcase_22 AC 5 ms
8,252 KB
testcase_23 AC 5 ms
8,316 KB
testcase_24 AC 5 ms
8,284 KB
testcase_25 AC 4 ms
8,272 KB
testcase_26 AC 96 ms
14,496 KB
testcase_27 AC 97 ms
14,440 KB
testcase_28 AC 80 ms
14,868 KB
testcase_29 AC 77 ms
11,892 KB
testcase_30 AC 77 ms
11,904 KB
testcase_31 AC 78 ms
12,032 KB
testcase_32 AC 80 ms
12,048 KB
testcase_33 AC 78 ms
12,260 KB
testcase_34 WA -
testcase_35 AC 73 ms
11,280 KB
testcase_36 AC 40 ms
9,976 KB
testcase_37 AC 82 ms
12,672 KB
testcase_38 AC 67 ms
11,872 KB
testcase_39 AC 49 ms
11,112 KB
testcase_40 AC 60 ms
12,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

 #include<bits/stdc++.h>
 using namespace std;
#define INF 1000000000
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
typedef long long LL;
int N;
int M;
vector<int>G[100001];//辺の相手
vector<int>num[100001];//辺番号
bool used[100001];
bool in[100001];
int main(){
    cin>>N>>M;
    REP(i,M){
        int a,b;
        cin>>a>>b;
        G[a].push_back(b);
        num[a].push_back(i);
        G[b].push_back(a);
        num[b].push_back(i);
    }
    REP(i,100001){
        used[i]=false;
        in[i]=false;
    }
    REP(i,N){
        bool check=false;
        REP(j,G[i].size()){
            if(used[num[i][j]]==false){
               used[num[i][j]]=true;
               check=true;
            }
        }
        if(check){
            in[i]=true;
        }
    }
    for(int i=N-1;i>0;i--){
        bool check=false;
        REP(j,G[i].size()){
            if(used[num[i][j]]==false){
               check=true;
            }
            if(in[G[i][j]]==false){
               check=true;
            }
        }
        if(check==false){
            in[i]=false;
            REP(j,G[i].size()){
                used[num[i][j]]=false;
            }
        }
    }
    bool check=false;
    for(int i=N-1;i>=0;i--){
        if(in[i]){
           check=true;
           cout<<1;
        }else{
           if(check){
              cout<<0;
           }
        }
    }
    cout<<endl;
    return 0;
}
0