結果

問題 No.607 開通777年記念
コンテスト
ユーザー 0w1
提出日時 2017-12-14 12:56:33
言語 C++17
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 117 ms / 2,000 ms
+ 393µs
コード長 806 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,325 ms
コンパイル使用メモリ 218,428 KB
実行使用メモリ 9,864 KB
最終ジャッジ日時 2026-10-13 10:36:59
合計ジャッジ時間 2,896 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;

const int MAXN = 1 << 10;
const int MAXM = 1 << 10;

int N, M;
int A[MAXM][MAXN];
int cur[MAXN];
int pcur[MAXN + 1];

signed main() {
  ios::sync_with_stdio(false);
  cin >> N >> M;
  for (int i = 0; i < M; ++i) {
    for (int j = 0; j < N; ++j) {
      cin >> A[i][j];
    }
  }
  for (int i = 0; i < M; ++i) {
    for (int j = 0; j < N; ++j) {
      cur[j] += A[i][j];
    }
    for (int j = 0; j < N; ++j) {
      pcur[j + 1] = pcur[j] + cur[j];
    }
    multiset<int> bag;
    for (int j = 0; j <= N; ++j) {
      bag.emplace(pcur[j]);
    }
    for (int j = 0; j < N; ++j) {
      bag.erase(bag.find(pcur[j]));
      if (bag.count(777 + pcur[j])) {
        cout << "YES" << endl;
        exit(0);
      }
    }
  }
  cout << "NO" << endl;
  return 0;
}
0