結果

問題 No.607 開通777年記念
ユーザー syunsuke
提出日時 2018-07-29 18:19:39
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,162 bytes
コンパイル時間 432 ms
コンパイル使用メモリ 66,004 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-18 09:15:22
合計ジャッジ時間 4,757 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
using namespace std;
int main(void){
    // Your code here!
    string ANS="NO";
    int N,M,NUM=0,num=0,ans=0,n;
    scanf("%d %d",&N,&M);
    int L[N];
    for (int i=0;i<N;i++){
        L[i]=0;
    }
    
    for (int l=0;l<=M;l++){
        for (int i=0;i<N;i++){
            scanf("%d",&n);
            L[i]+=n;
            //cout<<L[4]<<endl;
            ans=0;
            num=0;
            NUM=0;
            for (int j=0;j<1000000000;j++){
                if (ans==777){
                    ANS="YES";
                    break;
                }
                else if (ans>777){
                    ans=ans-L[num];
                    num+=1;
                    //cout<<j<<endl;
                }
                else if (ans<777){
                    if (NUM>N){
                        break;
                    }
                    else{
                    ans=ans+L[NUM];
                    //cout<<L[NUM]<<endl;
                    NUM+=1;
                    
                    }
                }
            //cout<<ans<<endl;   
            }
        }
    }
    cout<<ANS<<endl;
    return 0;
}
0