結果

問題 No.607 開通777年記念
ユーザー 👑 はまやんはまやんはまやんはまやん
提出日時 2017-12-08 17:13:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,615 bytes
コンパイル時間 1,530 ms
コンパイル使用メモリ 169,784 KB
実行使用メモリ 7,364 KB
最終ジャッジ日時 2024-05-07 05:37:46
合計ジャッジ時間 2,447 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 WA -
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 20 ms
5,504 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 3 ms
5,376 KB
testcase_10 AC 4 ms
5,376 KB
testcase_11 AC 92 ms
7,364 KB
testcase_12 AC 85 ms
7,308 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, N) rep(j, 0, M) cin >> A[i][j];
    rep(i, 1, N) rep(j, 0, M) A[i][j] += A[i - 1][j];
    rep(i, 0, N) rep(j, 1, M) A[i][j] += A[i][j - 1];

    string ans = no;
    rep(i, 0, N) {
        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