結果

問題 No.607 開通777年記念
ユーザー t98slidert98slider
提出日時 2023-01-18 04:06:04
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 580 bytes
コンパイル時間 1,447 ms
コンパイル使用メモリ 166,116 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-02 01:15:09
合計ジャッジ時間 2,984 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int w, h;
    cin >> w >> h;
    vector<int> A(w);
    for(int y = 0; y < h; y++){
        for(int x = 0, v; x < w; x++){
            cin >> v;
            A[x] += v;
        }
        for(int l = 0, r = 0, s = 0; l < w; l++){
            while(r < w && s < 777)s += A[r++];
            if(s == 777){
                cout << "YES" << '\n';
                return 0;
            }
            s -= A[l];
        }
    }
    cout << "NO" << '\n';
}
0