結果

問題 No.607 開通777年記念
ユーザー iqueue02iqueue02
提出日時 2019-10-26 15:37:28
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 259 ms / 2,000 ms
コード長 770 bytes
コンパイル時間 1,475 ms
コンパイル使用メモリ 169,828 KB
実行使用メモリ 7,356 KB
最終ジャッジ日時 2023-10-12 10:35:23
合計ジャッジ時間 3,080 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 2 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,352 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 36 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 4 ms
4,348 KB
testcase_10 AC 5 ms
4,352 KB
testcase_11 AC 259 ms
7,356 KB
testcase_12 AC 242 ms
7,108 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
#define sz(x) int(x.size())
typedef long long ll;
typedef pair<int,int> P;

int main(){
  int n, m;
  cin >> n >> m;
  vector<vector<int>> num(m,vector<int>(n,0));
  rep(i,m) rep(j,n) cin >> num[i][j];
  for (int i = 1; i < m; i++) rep(j,n) num[i][j] += num[i-1][j];
  rep(i,m) rep(j,n-1) num[i][j+1] += num[i][j]; 
  bool ok = false;
  rep(i,m) {
    rep(j,n) {
      int v = num[i][j] - 777;
      if (v < 0) continue;
      if (v == 0) ok = true;
      int itr = lower_bound(num[i].begin(), num[i].end(), v) - num[i].begin();
      if (itr != j && num[i][j] - num[i][itr] == 777) ok = true;
    }
  }
  if (ok) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}
0