結果
問題 | No.607 開通777年記念 |
ユーザー |
![]() |
提出日時 | 2017-11-29 22:44:15 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 103 ms / 2,000 ms |
コード長 | 832 bytes |
コンパイル時間 | 424 ms |
コンパイル使用メモリ | 42,240 KB |
実行使用メモリ | 6,912 KB |
最終ジャッジ日時 | 2024-11-27 19:17:30 |
合計ジャッジ時間 | 1,874 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 10 |
ソースコード
#include <cstdio>#include <algorithm>using namespace std;typedef long long int ll;int N, M;int a[1010][1010];int cur[1010];int main() {scanf("%d%d", &N, &M);for(int i=0; i<M; i++) {for(int j=0; j<N; j++) {scanf("%d", &a[i][j]);}}for(int i=0; i<M; i++) {for(int j=0; j<N; j++) cur[j] += a[i][j];int lb = 0, ub = 0, val = 0;while(ub < N) {while(val + cur[ub] <= 777 && ub < N) {val += cur[ub++];}if(val == 777) {printf("YES\n");return 0;}if(lb == ub) {lb++;ub++;}else {val -= cur[lb++];}}}printf("NO\n");return 0;}