結果

問題 No.607 開通777年記念
ユーザー face4face4
提出日時 2018-05-18 23:22:43
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 188 ms / 2,000 ms
コード長 644 bytes
コンパイル時間 717 ms
コンパイル使用メモリ 64,828 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-10 23:12:06
合計ジャッジ時間 2,290 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 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,384 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 12 ms
4,380 KB
testcase_08 AC 2 ms
4,384 KB
testcase_09 AC 4 ms
4,376 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 184 ms
4,376 KB
testcase_12 AC 188 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
using namespace std;

int main(){
    int n, m;
    cin >> n >> m;
    int sum[n] = {};

    int x;
    for(int i = 0; i < m; i++){
        for(int j = 0; j < n; j++){
            cin >> x;
            sum[j] += x;
        }

        int left = -1, right = 0, ans = 0;
        for(right = 0; right < n; right++){
            ans += sum[right];
            while(ans>777 && left < right){
                left++;
                ans -= sum[left];
            }

            if(ans==777){
                cout << "YES" << endl;
                return 0;
            }
        }
    }

    cout << "NO" << endl;

    return 0;
}
0