結果

問題 No.607 開通777年記念
コンテスト
ユーザー te-sh
提出日時 2017-12-07 10:22:39
言語 D
(dmd 2.113.0)
コンパイル:
dmd -fPIE -m64 -w -wi -O -release -inline -I/opt/dmd/src/druntime/import/ -I/opt/dmd/src/phobos -L-L/opt/dmd/linux/lib64/ -fPIC _filename_
実行:
./Main
結果
AC  
実行時間 51 ms / 2,000 ms
+ 853µs
コード長 632 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 469 ms
コンパイル使用メモリ 86,108 KB
実行使用メモリ 9,820 KB
最終ジャッジ日時 2026-10-13 10:34:47
合計ジャッジ時間 1,867 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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 a = new int[](n), b = new int[](n);
  foreach (i; 0..m) {
    auto rd2 = readln.splitter;
    foreach (j; 0..n) {
      a[j] = rd2.front.to!int;
      rd2.popFront();
    }
    foreach (j; 1..n) a[j] += a[j-1];
    b[] += a[];

    auto bs = b.assumeSorted!"a < b";
    if (bs.contains(777)) {
      writeln("YES");
      return;
    }
    foreach (bi; bs.upperBound(777)) {
      if (bs.contains(bi-777)) {
        writeln("YES");
        return;
      }
    }
  }
  writeln("NO");
}
0