結果

問題 No.479 頂点は要らない
ユーザー ei1333333ei1333333
提出日時 2017-01-27 23:58:32
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 78 ms / 1,500 ms
コード長 535 bytes
コンパイル時間 1,287 ms
コンパイル使用メモリ 148,096 KB
実行使用メモリ 9,188 KB
最終ジャッジ日時 2023-08-25 11:11:02
合計ジャッジ時間 4,030 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,804 KB
testcase_01 AC 3 ms
5,860 KB
testcase_02 AC 3 ms
5,852 KB
testcase_03 AC 3 ms
5,804 KB
testcase_04 AC 4 ms
5,844 KB
testcase_05 AC 4 ms
5,796 KB
testcase_06 AC 3 ms
5,840 KB
testcase_07 AC 2 ms
5,992 KB
testcase_08 AC 2 ms
5,852 KB
testcase_09 AC 3 ms
5,860 KB
testcase_10 AC 3 ms
5,856 KB
testcase_11 AC 3 ms
5,844 KB
testcase_12 AC 3 ms
5,848 KB
testcase_13 AC 3 ms
5,792 KB
testcase_14 AC 4 ms
5,804 KB
testcase_15 AC 3 ms
5,860 KB
testcase_16 AC 3 ms
5,804 KB
testcase_17 AC 4 ms
5,864 KB
testcase_18 AC 3 ms
5,916 KB
testcase_19 AC 4 ms
5,820 KB
testcase_20 AC 4 ms
5,840 KB
testcase_21 AC 4 ms
5,816 KB
testcase_22 AC 4 ms
6,020 KB
testcase_23 AC 3 ms
6,092 KB
testcase_24 AC 3 ms
6,024 KB
testcase_25 AC 4 ms
5,956 KB
testcase_26 AC 78 ms
9,144 KB
testcase_27 AC 77 ms
9,068 KB
testcase_28 AC 63 ms
9,188 KB
testcase_29 AC 65 ms
7,884 KB
testcase_30 AC 64 ms
7,756 KB
testcase_31 AC 65 ms
7,692 KB
testcase_32 AC 64 ms
7,708 KB
testcase_33 AC 69 ms
7,952 KB
testcase_34 AC 74 ms
8,076 KB
testcase_35 AC 65 ms
7,572 KB
testcase_36 AC 36 ms
6,748 KB
testcase_37 AC 72 ms
8,140 KB
testcase_38 AC 59 ms
7,780 KB
testcase_39 AC 42 ms
7,356 KB
testcase_40 AC 50 ms
8,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main()
{
  int N, M;
  vector< int > g[100000];
  cin >> N >> M;
  while(M--) {
    int A, B;
    cin >> A >> B;
    g[A].push_back(B);
    g[B].push_back(A);
  }

  string S = string(N, '1');
  bool st[100000];
  memset(st, true, sizeof(st));
  for(int i = N - 1; i >= 0; i--) {
    st[i] = true;
    for(auto &to : g[i]) st[i] &= st[to];
    st[i] ^= 1;
    if(st[i] == 0) S[i] = '0';
  }
  while(S.back() == '0') S.pop_back();
  reverse(begin(S), end(S));
  cout << S << endl;

}
0