結果

問題 No.479 頂点は要らない
ユーザー te-shte-sh
提出日時 2017-12-11 16:09:36
言語 D
(dmd 2.107.1)
結果
AC  
実行時間 89 ms / 1,500 ms
コード長 563 bytes
コンパイル時間 602 ms
コンパイル使用メモリ 88,024 KB
実行使用メモリ 9,492 KB
最終ジャッジ日時 2023-09-03 17:27:07
合計ジャッジ時間 4,771 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,380 KB
testcase_16 AC 1 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 1 ms
4,380 KB
testcase_19 AC 2 ms
4,380 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,376 KB
testcase_24 AC 2 ms
4,380 KB
testcase_25 AC 3 ms
4,376 KB
testcase_26 AC 88 ms
8,276 KB
testcase_27 AC 89 ms
8,184 KB
testcase_28 AC 85 ms
8,280 KB
testcase_29 AC 84 ms
7,228 KB
testcase_30 AC 84 ms
7,512 KB
testcase_31 AC 84 ms
6,960 KB
testcase_32 AC 83 ms
6,232 KB
testcase_33 AC 79 ms
9,492 KB
testcase_34 AC 86 ms
7,444 KB
testcase_35 AC 77 ms
6,984 KB
testcase_36 AC 47 ms
5,184 KB
testcase_37 AC 85 ms
6,968 KB
testcase_38 AC 72 ms
5,780 KB
testcase_39 AC 53 ms
6,380 KB
testcase_40 AC 64 ms
7,432 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto rd = readln.split.to!(int[]), n = rd[0], m = rd[1];
  auto g = new int[][](n);
  foreach (i; 0..m) {
    auto rd2 = readln.splitter;
    auto a = rd2.front.to!int; rd2.popFront();
    auto b = rd2.front.to!int;
    g[a] ~= b;
    g[b] ~= a;
  }

  auto b = new bool[](n);
  foreach_reverse (i; 0..n)
    if (!b[i])
      foreach (e; g[i])
        if (e < i)
          b[e] = true;

  b.reverse();

  foreach (bi; b[b.countUntil(true)..$])
    write(bi ? 1 : 0);
  writeln;
}
0