結果
| 問題 | No.607 開通777年記念 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2017-12-07 10:22:39 | 
| 言語 | D (dmd 2.109.1) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 115 ms / 2,000 ms | 
| コード長 | 632 bytes | 
| コンパイル時間 | 688 ms | 
| コンパイル使用メモリ | 104,128 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-06-12 22:51:40 | 
| 合計ジャッジ時間 | 1,595 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 10 | 
ソースコード
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");
}
            
            
            
        