結果
| 問題 | 
                            No.3165 [Cherry 7th Tune A] Croissants Continu
                             | 
                    
| コンテスト | |
| ユーザー | 
                             ymm-knight
                         | 
                    
| 提出日時 | 2025-06-16 18:13:41 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 80 ms / 2,000 ms | 
| コード長 | 814 bytes | 
| コンパイル時間 | 2,202 ms | 
| コンパイル使用メモリ | 199,040 KB | 
| 実行使用メモリ | 7,844 KB | 
| 最終ジャッジ日時 | 2025-06-16 18:13:49 | 
| 合計ジャッジ時間 | 6,991 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 31 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
#define Loop(x,l,r) for (ll x = ll(l); x < ll(r); ++x)
#define LoopR(x,l,r) for (ll x = ll(r)-1; x >= ll(l); --x)
#define Looc(x,l,r) for (ll x = ll(l); x <= ll(r); ++x)
#define LoocR(x,l,r) for (ll x = ll(r); x >= ll(l); --x)
#define int ll
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
#ifndef DB
#define DB 0
#define endl '\n'
#endif
#define debugl(l) if constexpr ((l) < DB)
#define debug debugl(0)
void solve()
{
	int n;
	cin >> n;
	vector<ll> a(n);
	for (auto &x : a)
		cin >> x;
	sort(a.begin(), a.end());
	ll sum = 0;
	Loop (i,0,n-1)
		sum += a[i];
	a.back() = min(a.back(), sum+1);
	sum += a.back();
	cout << sum << '\n';
}
signed main()
{
	cin.tie(0) -> sync_with_stdio(false);
	int t = 1;
	cin >> t;
	while (t--)
		solve();
}
            
            
            
        
            
ymm-knight