結果

問題 No.607 開通777年記念
ユーザー ミドリムシミドリムシ
提出日時 2017-12-07 06:37:14
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 787 bytes
コンパイル時間 583 ms
コンパイル使用メモリ 69,008 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-11-29 03:09:19
合計ジャッジ時間 2,150 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int main(){
    int N, M;
    cin >> N >> M;
    int vehicles[N];
    fill(vehicles, vehicles + N, 0);
    for(int i = 0; i < M; i++){
        for(int j = 0; j < N; j++){
            int plus;
            cin >> plus;
            vehicles[j] += plus;
        }
        int left = 0;
        int right = 0;
        int sum = 0;
        while(right < N){
            if(sum < 777){
                sum += vehicles[right];
                right++;
            }else if(sum > 777){
                sum -= vehicles[left];
                left++;
            }
            if(sum == 777){
                cout << "YES" << endl;
                return 0;
            }
        }
    }
    cout << "NO" << endl;
}
0