結果

問題 No.274 The Wall
ユーザー te-shte-sh
提出日時 2017-06-05 17:25:08
言語 D
(dmd 2.107.1)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 595 bytes
コンパイル時間 703 ms
コンパイル使用メモリ 87,820 KB
実行使用メモリ 12,100 KB
最終ジャッジ日時 2023-09-03 13:57:34
合計ジャッジ時間 4,766 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 216 ms
11,536 KB
testcase_12 AC 201 ms
11,564 KB
testcase_13 AC 5 ms
4,376 KB
testcase_14 AC 37 ms
5,884 KB
testcase_15 AC 73 ms
8,020 KB
testcase_16 AC 158 ms
10,660 KB
testcase_17 AC 152 ms
11,044 KB
testcase_18 AC 172 ms
10,252 KB
testcase_19 AC 159 ms
11,596 KB
testcase_20 AC 165 ms
11,324 KB
testcase_21 AC 174 ms
11,108 KB
testcase_22 AC 216 ms
11,320 KB
testcase_23 AC 182 ms
12,040 KB
testcase_24 AC 183 ms
11,828 KB
testcase_25 AC 161 ms
12,100 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

void main()
{
  auto rd1 = readln.split.to!(size_t[]), n = rd1[0], m = rd1[1];

  auto g = new bool[][](n, m);
  foreach (i; 0..n) {
    auto rd2 = readln.split.to!(size_t[]), l = rd2[0], r = rd2[1] + 1;
    foreach (j; l..r) g[i][j] = true;
  }

  auto ci = new int[](m);
  foreach (i; 0..m)
    ci[i] = g.transversal(i).count!"a".to!int;

  if (m % 2 && ci[m/2+1] >= 2) {
    writeln("NO");
    return;
  }

  foreach (i; 0..m/2)
    if (ci[i] + ci[$-i-1] >= 3) {
      writeln("NO");
      return;
    }

  writeln("YES");
}
0