結果

問題 No.607 開通777年記念
ユーザー naotaka nakanenaotaka nakane
提出日時 2023-02-22 22:47:59
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 100 ms / 2,000 ms
コード長 1,892 bytes
コンパイル時間 1,687 ms
コンパイル使用メモリ 171,992 KB
実行使用メモリ 18,888 KB
最終ジャッジ日時 2023-09-30 05:13:22
合計ジャッジ時間 3,065 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 19 ms
6,964 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 3 ms
4,380 KB
testcase_11 AC 100 ms
18,888 KB
testcase_12 AC 95 ms
18,820 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vvi = vector<vi>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vs = vector<string>;

const int IntINF = 1 << 30;
const ll LLINF = 1LL << 60;

#define REP(i, a, n) for (ll i = (a); i < (ll)(n); ++i)
#define rep(i, n) REP(i, 0, n)

#define what_is(x) cerr << #x << " is " << x << endl;

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p) {
  os << p.first << " " << p.second;
  return os;
}

template <typename T> ostream &operator<<(ostream &os, const vector<T> &v) {
  rep(i, v.size()) { os << v[i] << (i < (ll)v.size() - 1 ? " " : ""); }
  return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<vector<T>> &v) {
  rep(i, v.size()) {
    rep(j, v[i].size()) {
      os << v[i][j] << (j < (ll)v[i].size() - 1 ? " " : "");
    }
    os << endl;
  }
  return os;
}

template <typename T, typename U>
ostream &operator<<(ostream &os, const map<T, U> &v) {
  for (const auto &p : v) {
    os << p.first << ": " << p.second << endl;
  }
  return os;
}

inline void io_setup(int precision = 15) {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(precision);
  cerr << fixed << setprecision(precision);
}

int main() {
  io_setup();

  int N, M;
  cin >> N >> M;
  vvll A(M, vll(N));
  rep(i, M) rep(j, N) cin >> A[i][j];

  REP(i, 1, M) {
    rep(j, N) { A[i][j] += A[i - 1][j]; }
  }

  vvll sum(M, vll(N + 1));
  rep(i, M) {
    rep(j, N) { sum[i][j + 1] = sum[i][j] + A[i][j]; }
  }

  rep(i, M) {
    rep(j, N + 1) {
      auto l_iter = sum[i].begin() + j;
      bool found = binary_search(l_iter, sum[i].end(), 777 + sum[i][j]);
      if (found) {
        cout << "YES" << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;

  return 0;
}
0