結果
問題 |
No.3165 [Cherry 7th Tune A] Croissants Continu
|
ユーザー |
|
提出日時 | 2025-05-30 21:28:07 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 236 ms / 2,000 ms |
コード長 | 321 bytes |
コンパイル時間 | 3,465 ms |
コンパイル使用メモリ | 279,604 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-05-30 21:28:17 |
合計ジャッジ時間 | 8,906 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 31 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll=long long; int main(){ int ttt; cin>>ttt; while(ttt--){ int n; cin>>n; vector<ll> a(n); for(int i=0;i<n;i++)cin>>a[i]; sort(a.begin(),a.end()); ll ans=0; for(int i=0;i<n-1;i++)ans+=a[i]; ans+=min(a[n-1],ans+1); cout<<ans<<endl; } return 0; }