답안 #902446

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
902446 2024-01-10T12:18:20 Z HamzaT Autići (COCI22_autici) C++14
0 / 50
0 ms 600 KB
//struct Edge {int u, v, weight;bool operator<(Edge const& other) {return weight < other.weight;}};
#include <bits/stdc++.h>
#define endl "\n"
#define ll long long
#define sp ' '
#define pb push_back
#define ar for(int i=1;i<=n;i++)
using namespace std;
ll t=1;
const ll N=3e5+100;
ll n,m,q,k;
ll a[N];
ll ans=0;
void solve()
{
    ans=0;
    cin>>n;
    ar{cin>>a[i];}
    sort(a+1,a+n+1);
    for(int i=1;i<=n-2;i++)
    {
        ans+=(a[i]*2);
    }
    ans+=a[n-1]+a[n];
    cout<<ans<<endl;return;
}
int main()
{
    //freopen("shell.in", "r", stdin);
   // freopen("shell.out", "w", stdout);
    ios::sync_with_stdio(NULL);
    cin.tie(NULL);cout.tie(NULL);
     //cin>>t;
    while(t--){solve();}
    return 0;
}
//09:00 :: 9:45
//10:30 ::
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 600 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -