結果

問題 No.944 煎っぞ!
ユーザー risujirohrisujiroh
提出日時 2019-12-07 00:04:05
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 59 ms / 3,000 ms
コード長 578 bytes
コンパイル時間 1,391 ms
コンパイル使用メモリ 173,180 KB
実行使用メモリ 8,316 KB
最終ジャッジ日時 2023-08-25 18:23:27
合計ジャッジ時間 3,532 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
8,040 KB
testcase_01 AC 30 ms
8,128 KB
testcase_02 AC 32 ms
8,232 KB
testcase_03 AC 32 ms
8,300 KB
testcase_04 AC 31 ms
8,028 KB
testcase_05 AC 31 ms
8,224 KB
testcase_06 AC 32 ms
8,128 KB
testcase_07 AC 31 ms
8,080 KB
testcase_08 AC 31 ms
8,080 KB
testcase_09 AC 32 ms
8,152 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 9 ms
4,540 KB
testcase_12 AC 5 ms
4,380 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 8 ms
4,540 KB
testcase_15 AC 5 ms
4,380 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 9 ms
4,540 KB
testcase_19 AC 9 ms
4,384 KB
testcase_20 AC 47 ms
8,084 KB
testcase_21 AC 46 ms
8,068 KB
testcase_22 AC 34 ms
8,020 KB
testcase_23 AC 31 ms
8,128 KB
testcase_24 AC 32 ms
8,104 KB
testcase_25 AC 31 ms
8,204 KB
testcase_26 AC 31 ms
8,132 KB
testcase_27 AC 41 ms
8,016 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 43 ms
8,184 KB
testcase_31 AC 59 ms
8,216 KB
testcase_32 AC 42 ms
8,316 KB
testcase_33 AC 36 ms
8,176 KB
testcase_34 AC 37 ms
8,108 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n);
  int sum = 0;
  set<int> se{0};
  for (auto&& e : a) {
    cin >> e;
    sum += e;
    se.insert(sum);
  }
  int res = 0;
  for (int d = 1; d <= sum; ++d) {
    if (sum % d == 0) {
      bool ok = true;
      for (int i = d; i <= sum; i += d) {
        if (not se.count(i)) {
          ok = false;
          break;
        }
      }
      if (ok) {
        res = max(res, sum / d);
      }
    }
  }
  cout << res << '\n';
}
0