結果

問題 No.479 頂点は要らない
ユーザー ミドリムシミドリムシ
提出日時 2018-03-08 23:01:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 90 ms / 1,500 ms
コード長 749 bytes
コンパイル時間 758 ms
コンパイル使用メモリ 74,412 KB
実行使用メモリ 9,572 KB
最終ジャッジ日時 2024-04-15 12:21:50
合計ジャッジ時間 3,945 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 3 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 3 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 3 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 90 ms
9,216 KB
testcase_27 AC 88 ms
9,344 KB
testcase_28 AC 71 ms
9,572 KB
testcase_29 AC 72 ms
6,784 KB
testcase_30 AC 71 ms
6,784 KB
testcase_31 AC 70 ms
6,784 KB
testcase_32 AC 72 ms
6,784 KB
testcase_33 AC 75 ms
7,040 KB
testcase_34 AC 86 ms
7,168 KB
testcase_35 AC 72 ms
5,760 KB
testcase_36 AC 38 ms
5,376 KB
testcase_37 AC 80 ms
7,424 KB
testcase_38 AC 67 ms
6,528 KB
testcase_39 AC 47 ms
6,272 KB
testcase_40 AC 57 ms
7,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
    int n, m;
    cin >> n >> m;
    vector<int> roads[n];
    for(int i = 0; i < m; i++){
        int start, goal;
        cin >> start >> goal;
        roads[start].push_back(goal);
        roads[goal].push_back(start);
    }
    bool if_choose[n];
    fill(if_choose, if_choose + n, false);
    string ans;
    for(int i = n - 1; i >= 0; i--){
        if(!if_choose[i]){
            for(int j = 0; j < roads[i].size(); j++){
                if_choose[roads[i][j]] = true;
            }
            if(ans != ""){
                ans.push_back('0');
            }
        }else{
            ans.push_back('1');
        }
    }
    cout << ans << endl;
}
0