結果

問題 No.607 開通777年記念
ユーザー rodearodea
提出日時 2018-11-03 16:34:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 230 ms / 2,000 ms
コード長 744 bytes
コンパイル時間 1,524 ms
コンパイル使用メモリ 169,232 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-30 21:12:31
合計ジャッジ時間 2,791 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;

int MOD=1e9+7;
ll INF=1e18;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};

int main(){
    int n, m; cin>>n>>m;
    vector<int> a(n), train(n, 0);
    bool just777=false;
    for(int i=0; i<m; i++){
        for(int j=0; j<n; j++){
            cin>>a[j];
            train[j]+=a[j];
        }

        int l=0, r=0, sum=0;
        while(r<n){
            sum+=train[r];
            while(777<sum && l<n){
                sum-=train[l];
                l++;
            }
            r++;
            if(sum==777) just777=true;
        }
    }

    if(just777) cout << "YES" << endl;
    else cout << "NO" << endl;
}
0