結果

問題 No.3165 [Cherry 7th Tune A] Croissants Continu
ユーザー GOTKAKO
提出日時 2025-05-30 21:35:34
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 424 bytes
コンパイル時間 1,974 ms
コンパイル使用メモリ 195,232 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-05-30 21:35:38
合計ジャッジ時間 4,264 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int T; cin >> T;
    while(T--){
        int N; cin >> N;
        vector<long long> A(N);
        for(auto &a : A) cin >> a;
        long long sum = 0,maxa = 0;
        for(auto a : A) sum += a,maxa = max(maxa,a);
        
        sum -= maxa;
        cout << min(sum+maxa,sum+sum+1) << "\n";
    }
}
0