結果
問題 | No.607 開通777年記念 |
ユーザー |
![]() |
提出日時 | 2017-12-07 01:01:18 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 697 bytes |
コンパイル時間 | 778 ms |
コンパイル使用メモリ | 99,792 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-12 22:51:16 |
合計ジャッジ時間 | 1,790 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 9 WA * 1 |
ソースコード
void main(){import std.stdio, std.string, std.conv, std.algorithm;int n, m; rd(n, m);auto a=new int[](n);int tg=777; bool ok=false;while(m--){auto d=readln.split.to!(int[]);if(ok) continue;foreach(i; 0..n) a[i]+=d[i];auto sum=0, l=0, r=0;while(r<n){sum+=a[r++];if(sum==tg){ok=true; break;}while(l<r && sum>tg) sum-=a[l++];}}writeln(ok?"YES":"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;}