답안 #902453

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
902453 2024-01-10T12:27:42 Z HamzaT Autići (COCI22_autici) C++14
50 / 50
17 ms 3708 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];}
    if(n==1){cout<<ans<<endl;return;}
    sort(a+1,a+n+1);
    ar{ans+=a[i];}
    ans+=a[1]*(n-2);
    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 Correct 1 ms 352 KB Output is correct
2 Correct 6 ms 2652 KB Output is correct
3 Correct 9 ms 3708 KB Output is correct
4 Correct 10 ms 3432 KB Output is correct
5 Correct 13 ms 3420 KB Output is correct
6 Correct 8 ms 3324 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 360 KB Output is correct
2 Correct 0 ms 360 KB Output is correct
3 Correct 0 ms 476 KB Output is correct
4 Correct 0 ms 360 KB Output is correct
5 Correct 0 ms 360 KB Output is correct
6 Correct 1 ms 360 KB Output is correct
7 Correct 0 ms 360 KB Output is correct
8 Correct 1 ms 360 KB Output is correct
9 Correct 1 ms 360 KB Output is correct
10 Correct 1 ms 360 KB Output is correct
11 Correct 1 ms 488 KB Output is correct
12 Correct 0 ms 360 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 352 KB Output is correct
2 Correct 6 ms 2652 KB Output is correct
3 Correct 9 ms 3708 KB Output is correct
4 Correct 10 ms 3432 KB Output is correct
5 Correct 13 ms 3420 KB Output is correct
6 Correct 8 ms 3324 KB Output is correct
7 Correct 1 ms 360 KB Output is correct
8 Correct 0 ms 360 KB Output is correct
9 Correct 0 ms 476 KB Output is correct
10 Correct 0 ms 360 KB Output is correct
11 Correct 0 ms 360 KB Output is correct
12 Correct 1 ms 360 KB Output is correct
13 Correct 0 ms 360 KB Output is correct
14 Correct 1 ms 360 KB Output is correct
15 Correct 1 ms 360 KB Output is correct
16 Correct 1 ms 360 KB Output is correct
17 Correct 1 ms 488 KB Output is correct
18 Correct 0 ms 360 KB Output is correct
19 Correct 1 ms 360 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 8 ms 2652 KB Output is correct
22 Correct 9 ms 3580 KB Output is correct
23 Correct 13 ms 3432 KB Output is correct
24 Correct 13 ms 3608 KB Output is correct
25 Correct 15 ms 3432 KB Output is correct
26 Correct 13 ms 3432 KB Output is correct
27 Correct 14 ms 3432 KB Output is correct
28 Correct 17 ms 3432 KB Output is correct
29 Correct 14 ms 3432 KB Output is correct
30 Correct 13 ms 3688 KB Output is correct