結果
| 問題 |
No.944 煎っぞ!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-12-21 00:26:08 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,098 bytes |
| コンパイル時間 | 1,622 ms |
| コンパイル使用メモリ | 170,088 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-09-21 12:34:23 |
| 合計ジャッジ時間 | 3,744 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 WA * 32 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define mod 1000000007ll
#define loop(i, n) for (int i = 0; i < n; i++)
#define all(v) v.begin(), v.end()
#define putout(a) cout << a << '\n'
#define Sum(v) accumulate(all(v), 0ll)
template <typename T>
bool chmax(T &a, const T &b)
{
if (a < b)
{
a = b; // aをbで更新
return true;
}
return false;
}
int main()
{
ll N;
cin >> N;
vector<ll> A(N);
ll maxx = 0;
loop(i, N)
{
cin >> A[i];
chmax(maxx, A[i]);
}
ll S = Sum(A);
for (int i = N; i >= 1; i--)
{
if (S % i != 0 || (S / i) < maxx)
continue;
ll now = 0;
bool ng = false;
ll div = S / i; //各豆のおいしさ
loop(j, N)
{
now += A[i];
if (now > div)
{
ng = true;
break;
}
if (now == div)
now = 0;
}
if (ng || now != 0)
continue;
putout(i);
return 0;
}
return 0;
}