結果

問題 No.607 開通777年記念
ユーザー shunshunshunshun
提出日時 2018-10-13 17:42:09
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 954 ms / 2,000 ms
コード長 891 bytes
コンパイル時間 1,706 ms
コンパイル使用メモリ 157,560 KB
実行使用メモリ 7,424 KB
最終ジャッジ日時 2024-04-20 20:08:39
合計ジャッジ時間 4,290 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <bits/stdc++.h>
#define FOR(i, a, n) for(int i = (int)(a); i < (int)(n); ++i)
#define REP(i, n) FOR(i, 0, n)
using namespace std;
int main(){
    // Your code here

    int N,M;
    cin >> N>>M;

    int A[1000][1000];
    REP(i,M)REP(j,N) cin >>A[i][j];
    FOR(i,1,M)FOR(j,0,N) A[i][j]+=A[i-1][j];
    FOR(i,0,M)FOR(j,1,N) A[i][j]+=A[i][j-1];

    REP(i,M){
        REP(j,N){
            if(A[i][j]==777){
                cout <<"YES"<<endl;
                return 0;
            }else if(A[i][j]<777){
                continue;
            }else{
                REP(k,N){
                    int b = A[i][j]-A[i][k];
                    if (b==777){
                        cout <<"YES"<<endl;
                        return 0;
                    }
                }
            }

            
        }

    }
    cout << "NO"<<endl;
}

0