結果
| 問題 |
No.3165 [Cherry 7th Tune A] Croissants Continu
|
| コンテスト | |
| ユーザー |
ortogawa
|
| 提出日時 | 2025-07-25 10:49:56 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 67 ms / 2,000 ms |
| コード長 | 455 bytes |
| コンパイル時間 | 2,139 ms |
| コンパイル使用メモリ | 201,368 KB |
| 実行使用メモリ | 7,716 KB |
| 最終ジャッジ日時 | 2025-07-25 10:50:03 |
| 合計ジャッジ時間 | 5,941 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 31 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define int ll
#define fast_io cin.tie(0)->sync_with_stdio(0);
#define endl '\n'
typedef long long ll;
int32_t main() {
fast_io;
int t; cin >> t;
while (t--) {
int n; cin >> n;
vector<int> a(n);
for (auto &i : a) cin >> i;
sort(a.rbegin(), a.rend());
int mx = a[0];
int s = accumulate(a.begin() + 1, a.end(), 0ll);
if (mx <= s) cout << s + mx << endl;
else cout << 2*s + 1 << endl;
}
}
ortogawa