結果

問題 No.607 開通777年記念
ユーザー bombrary_skbombrary_sk
提出日時 2018-11-29 15:15:02
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 250 ms / 2,000 ms
コード長 756 bytes
コンパイル時間 474 ms
コンパイル使用メモリ 65,684 KB
実行使用メモリ 7,376 KB
最終ジャッジ日時 2023-09-09 05:52:25
合計ジャッジ時間 2,154 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
  int N, M;
  cin >> N >> M;

  vector<vector<int>> a(M, vector<int>(N));
  for (int i = 0; i < M; i++) {
    for (int j = 0; j < N; j++) {
      cin >> a[i][j];
    }
  }

  vector<int> now(N);
  vector<int> s(N + 2);
  s[0] = 0;
  s[N + 1] = 1100000000;
  for (int i = 0; i < M; i++) {
    for (int j = 0; j < N; j++) {
      now[j] += a[i][j];
    }
    for (int j = 0; j < N; j++) {
      s[j + 1] = s[j] + now[j];
    }
    for (int j = 0; j <= N; j++) {
      auto itr = lower_bound(s.begin(), s.end(), 777 + s[j]);
      if (*itr == 777 + s[j]) {
        cout << "YES" << endl;
        return 0;
      }
    }
  }
  cout << "NO" << endl;

  return 0;
}

0