結果

問題 No.2488 Mod Sum Maximization
ユーザー shiomusubi496shiomusubi496
提出日時 2023-09-29 14:36:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 381 bytes
コンパイル時間 2,025 ms
コンパイル使用メモリ 199,864 KB
実行使用メモリ 4,416 KB
最終ジャッジ日時 2023-09-29 20:59:43
合計ジャッジ時間 5,424 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 AC 88 ms
4,380 KB
testcase_05 WA -
testcase_06 AC 84 ms
4,376 KB
testcase_07 WA -
testcase_08 AC 85 ms
4,376 KB
testcase_09 AC 66 ms
4,376 KB
testcase_10 WA -
testcase_11 AC 3 ms
4,380 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 53 ms
4,380 KB
testcase_16 AC 4 ms
4,376 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 72 ms
4,380 KB
testcase_20 AC 78 ms
4,376 KB
testcase_21 AC 75 ms
4,380 KB
testcase_22 AC 85 ms
4,416 KB
testcase_23 AC 86 ms
4,380 KB
testcase_24 WA -
testcase_25 AC 3 ms
4,376 KB
testcase_26 WA -
testcase_27 AC 45 ms
4,376 KB
testcase_28 AC 46 ms
4,380 KB
testcase_29 AC 44 ms
4,380 KB
testcase_30 AC 29 ms
4,380 KB
testcase_31 AC 7 ms
4,380 KB
testcase_32 AC 71 ms
4,380 KB
testcase_33 AC 2 ms
4,376 KB
testcase_34 AC 85 ms
4,376 KB
testcase_35 AC 28 ms
4,376 KB
testcase_36 AC 1 ms
4,380 KB
testcase_37 AC 1 ms
4,376 KB
testcase_38 AC 2 ms
4,376 KB
testcase_39 AC 1 ms
4,376 KB
testcase_40 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)

using namespace std;

using ll = long long;

int main() {
	int N; cin >> N;
	vector<int> A(N);
	rep (i, N) cin >> A[i];
	ll ans = 0;
	rep (i, N) ans += A[i] % A[(i + 1) % N];
	ll mx = 0;
	rep (i, N) mx = max<ll>(mx, A[N - 1] % A[i] + A[i] % A[0] - A[i] - A[N - 1] % A[0]);
	cout << ans + mx << endl;
}
0