結果

問題 No.607 開通777年記念
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2017-12-08 17:15:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 1,615 bytes
コンパイル時間 1,476 ms
コンパイル使用メモリ 168,524 KB
実行使用メモリ 7,348 KB
最終ジャッジ日時 2023-08-19 22:34:55
合計ジャッジ時間 2,506 ms
ジャッジサーバーID
(参考情報)
judge14 / judge10
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,504 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 19 ms
5,420 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 3 ms
4,380 KB
testcase_10 AC 3 ms
4,380 KB
testcase_11 AC 86 ms
7,348 KB
testcase_12 AC 81 ms
7,292 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
            ∧_∧  
      ∧_∧  (´<_` )  Welcome to My Coding Space!
     ( ´_ゝ`) /  ⌒i     
    /   \     | |     
    /   / ̄ ̄ ̄ ̄/  |  
  __(__ニつ/     _/ .| .|____  
     \/____/ (u ⊃  
---------------------------------------------------------------------------------------------------*/




int N, M;
int A[1010][1010];
#define no "NO"
#define yes "YES"
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N >> M;
    rep(i, 0, M) rep(j, 0, N) cin >> A[i][j];
    rep(i, 1, M) rep(j, 0, N) A[i][j] += A[i - 1][j];
    rep(i, 0, M) rep(j, 1, N) A[i][j] += A[i][j - 1];

    string ans = no;
    rep(i, 0, M) {
        rep(j, 0, N) {
            int d = A[i][j] - 777;
            if (d < 0) continue;
            if (d == 0) ans = yes;
            int k = lower_bound(A[i], A[i] + j, d) - A[i];
            if (k != j) if (A[i][j] - A[i][k] == 777) ans = yes;
        }
    }
    cout << ans << endl;
}
0