답안 #696896

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
696896 2023-02-07T14:39:29 Z Do_you_copy Autići (COCI22_autici) C++17
50 / 50
41 ms 2044 KB
#include <bits/stdc++.h>
#define fi first
#define se second
#define faster ios_base::sync_with_stdio(0); cin.tie(0);
#define pb push_back
#define int long long
using namespace std;
using ll = long long;
using pii = pair <int, int>;

const int maxN = 1e5 + 1;
const int inf = 0x3f3f3f3f;
int n;
int a[maxN];
void Init(){
    cin >> n;
    int minn = inf;
    ll sum = 0;
    for (int i = 1; i <= n; ++i){
        cin >> a[i];
        minn = min(minn, a[i]);
        sum += a[i];
    }
    if (n == 1){
        cout << 0; exit(0);
    }
    cout << sum + minn * (n - 2);
}

#define taskname "test"

signed main(){
    if (fopen(taskname ".inp", "r")){
        freopen(taskname ".inp", "r", stdin);
        freopen(taskname ".out", "w", stdout);
    }
    int tt = 1;
    //cin >> tt;
    while (tt--){
        Init();
    }
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:34:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 |         freopen(taskname ".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:35:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   35 |         freopen(taskname ".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 14 ms 972 KB Output is correct
3 Correct 40 ms 1000 KB Output is correct
4 Correct 33 ms 1868 KB Output is correct
5 Correct 37 ms 1944 KB Output is correct
6 Correct 30 ms 1824 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 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 324 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 316 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 14 ms 972 KB Output is correct
3 Correct 40 ms 1000 KB Output is correct
4 Correct 33 ms 1868 KB Output is correct
5 Correct 37 ms 1944 KB Output is correct
6 Correct 30 ms 1824 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 324 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 320 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 316 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 312 KB Output is correct
21 Correct 12 ms 1108 KB Output is correct
22 Correct 38 ms 1944 KB Output is correct
23 Correct 38 ms 2044 KB Output is correct
24 Correct 35 ms 1824 KB Output is correct
25 Correct 38 ms 2032 KB Output is correct
26 Correct 33 ms 1868 KB Output is correct
27 Correct 41 ms 1992 KB Output is correct
28 Correct 35 ms 1852 KB Output is correct
29 Correct 36 ms 1928 KB Output is correct
30 Correct 36 ms 1996 KB Output is correct