結果

問題 No.607 開通777年記念
ユーザー YutaroYamanakaYutaroYamanaka
提出日時 2019-04-18 12:32:46
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 495 ms / 2,000 ms
コード長 890 bytes
コンパイル時間 503 ms
コンパイル使用メモリ 57,180 KB
実行使用メモリ 11,440 KB
最終ジャッジ日時 2023-10-22 08:08:15
合計ジャッジ時間 2,386 ms
ジャッジサーバーID
(参考情報)
judge10 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 51 ms
5,580 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 4 ms
4,348 KB
testcase_10 AC 4 ms
4,348 KB
testcase_11 AC 484 ms
11,440 KB
testcase_12 AC 495 ms
11,440 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int n, m;
int main(void){
    // Your code here!
    cin >> n >> m;
    int A[m][n];
    int B[m][n+1];

    for(int i = 0; i < m; i++){
        for(int j = 1; j <= n; j++){
            cin >> A[i][j];
        }
    }
    
    for(int i = 1; i < m; i++){
        for(int j = 1; j <= n; j++){
            A[i][j] = A[i][j] + A[i-1][j]; 
        }
    }
    
    for(int i = 0; i < m; i++){
        B[i][0] = 0;
        for(int j = 1; j <= n; j++){
            B[i][j] = B[i][j-1] + A[i][j];
        }
    }
    
    
    
    
    for(int k = 0; k < m; k++){
        for(int i = 1; i <= n; i++){
            for(int j = 1; j <= i; j++){
                if(B[k][i] - B[k][j-1] == 777){
                    cout << "YES" << endl;
                    return 0;
                }
            }
        }
    }
    
    
    cout << "NO" << endl;
    
}
0