結果

問題 No.607 開通777年記念
ユーザー ikdikd
提出日時 2017-12-08 15:45:30
言語 D
(dmd 2.106.1)
結果
TLE  
実行時間 -
コード長 698 bytes
コンパイル時間 2,606 ms
コンパイル使用メモリ 86,984 KB
実行使用メモリ 29,592 KB
最終ジャッジ日時 2023-09-03 17:20:31
合計ジャッジ時間 9,414 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,384 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 TLE -
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 23 ms
4,376 KB
testcase_10 AC 3 ms
4,380 KB
testcase_11 TLE -
testcase_12 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

void main(){
  import std.stdio, std.string, std.conv, std.algorithm;

  int n, m; rd(n, m);
  auto d=new int[][](m, n);
  foreach(i; 0..m) d[i]=readln.split.to!(int[]);

  auto a=new int[](n);
  int tg=777;
  bool ok=false;
  foreach(i; 0..m){
    a[]+=d[i][];
    foreach(l; 0..n)foreach(r; l..n){
      for(int k=l, s=0; k<=r; k++){
        if((s+=a[k])==tg){writeln("YES"); return;}
      }
    }
  }
  writeln("NO");
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x){
    e=l[i].to!(typeof(e));
  }
}
void wr(T...)(T x){
  import std.stdio;
  foreach(e; x) stderr.write(e, " ");
  stderr.writeln;
}
0