답안 #662475

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
662475 2022-11-26T09:58:37 Z Kenpar Autići (COCI22_autici) C++17
50 / 50
18 ms 2100 KB
#include "bits/stdc++.h"
using namespace std;

#define ll long long
#define endl '\n'

const ll MOD = 1e9+7;
const ll INF = 1e16;
const ll MAX = 1e5;

void solve(){
	ll n;
	cin>>n;

	vector<ll> arr(n);

	for(int i = 0; i < n; i++){
		cin>>arr[i];
	}

	sort(arr.begin(), arr.end());

	ll sum = 0;

	for(int i = 0; i < n; i++){
		if(i == 0) sum+= arr[i]*(n-1);
		else sum+=arr[i];
	}

	cout<<sum;
}	 

int main()
{
    cin.tie(NULL);
    ios::sync_with_stdio(NULL);
    int t = 1;

    //cin>>t;
    int temp = t;
    while(t--){
        //cout<<"Case #"<<temp - t<<" > "<<endl;
        solve();

        cout<<endl;
    }

    cout.flush();
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:40:9: warning: unused variable 'temp' [-Wunused-variable]
   40 |     int temp = t;
      |         ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 6 ms 980 KB Output is correct
3 Correct 12 ms 980 KB Output is correct
4 Correct 10 ms 1836 KB Output is correct
5 Correct 12 ms 1992 KB Output is correct
6 Correct 11 ms 1816 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 320 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 6 ms 980 KB Output is correct
3 Correct 12 ms 980 KB Output is correct
4 Correct 10 ms 1836 KB Output is correct
5 Correct 12 ms 1992 KB Output is correct
6 Correct 11 ms 1816 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 320 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 6 ms 1236 KB Output is correct
22 Correct 14 ms 2100 KB Output is correct
23 Correct 11 ms 2068 KB Output is correct
24 Correct 15 ms 1876 KB Output is correct
25 Correct 18 ms 1988 KB Output is correct
26 Correct 16 ms 1868 KB Output is correct
27 Correct 16 ms 1992 KB Output is correct
28 Correct 15 ms 1796 KB Output is correct
29 Correct 16 ms 1984 KB Output is correct
30 Correct 12 ms 1932 KB Output is correct