結果

問題 No.607 開通777年記念
ユーザー task4233task4233
提出日時 2018-04-30 20:21:47
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 640 ms / 2,000 ms
コード長 1,281 bytes
コンパイル時間 1,405 ms
コンパイル使用メモリ 163,692 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-10 08:30:14
合計ジャッジ時間 4,514 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define EACH(i,a) for (auto& i : a)
#define FOR(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RFOR(i,a,b) for(int i=(int)b-1;i>=(int)a;--i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define ALL(a) (a).begin(),(a).end()
#define debug(x) cerr << #x << ":" << x << endl;
#define OK(ok) cout << (ok ? "YES" : "NO") << endl;
typedef long long ll;

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail) {
  cin >> head; CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define LCIN(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)

const int INF = 1e9 + 1;
const int MOD = 1e9 + 7;
const int MAX_N = 1e3 + 1;
const int MAX_M = 1e3 + 1;

int N, M;
ll sum[MAX_N];
ll d[MAX_N];

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);

  cin >> N >> M;
  bool ok = false;
  REP(i, M) {
    memset(sum, 0, sizeof(sum));
    REP(j, N) {
      ll a; cin >> a;
      sum[j + 1] = sum[j] + a;
      d[j + 1] += sum[j + 1];
      // debug(d[j + 1]);
    }
    int ub = 0;
    REP(j, N + 1) {
      if (d[j] == 777) ok = true;
      REP(k, j) {
	if (d[j] - d[k] == 777) ok = true;
      }
    }
  }

  OK(ok);
  
  return 0;
}

0