結果
問題 |
No.3165 [Cherry 7th Tune A] Croissants Continu
|
ユーザー |
|
提出日時 | 2025-06-15 02:25:22 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 58 ms / 2,000 ms |
コード長 | 447 bytes |
コンパイル時間 | 2,993 ms |
コンパイル使用メモリ | 286,344 KB |
実行使用メモリ | 7,848 KB |
最終ジャッジ日時 | 2025-06-15 02:25:30 |
合計ジャッジ時間 | 7,794 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 31 |
ソースコード
#include<bits/stdc++.h> using namespace std; using ll =long long; #include<atcoder/math> using namespace atcoder; void solve(){ ll N; cin>>N; ll S=0; vector<ll> A(N); for(int i=0;i<N;i++){ cin>>A[i]; S+=A[i]; } sort(A.begin(),A.end()); if(S<A.back()*2){ ll Z=S-A.back(); cout<<2*Z+1<<"\n"; } else cout<<S<<"\n"; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int T=1; cin>>T; while(T--)solve(); }