結果

問題 No.607 開通777年記念
ユーザー kyo1
提出日時 2021-01-16 14:26:12
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 134 ms / 2,000 ms
コード長 584 bytes
コンパイル時間 2,446 ms
コンパイル使用メモリ 197,168 KB
最終ジャッジ日時 2025-01-17 22:48:46
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N, M;
  cin >> N >> M;
  vector<int> A(N, 0);
  for (int i = 0; i < M; i++) {
    for (int j = 0; j < N; j++) {
      int a;
      cin >> a;
      A[j] += a;
    }
    vector<int> B = {0};
    for (int j = 0; j < N; j++) {
      B.emplace_back(B.back() + A[j]);
    }
    for (int j = 0; j < N; j++) {
      if (binary_search(B.begin(), B.end(), B[j] + 777)) {
        cout << "YES" << '\n';
        return 0;
      }
    }
  }
  cout << "NO" << '\n';
  return 0;
}
0