Submission #531174

# Submission time Handle Problem Language Result Execution time Memory
531174 2022-02-28T00:38:45 Z KazamaHoang Autići (COCI22_autici) C++14
0 / 50
11 ms 324 KB
// no matter how hard you work, someone else is working harder
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a), _i = (b); i <= _i; ++ i)
#define FORD(i, b, a) for (int i = (b), _i = (a); i >= _i; -- i)
#define REP(i, b) for (int i = 0, _i = (b); i < _i; ++ i)
#define FORE(i, a) for (auto& i : a)
#define lb lower_bound
#define ub upper_bound
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define cntbit __builtin_popcountll
#define len(x) (int)x.size()
#define bit(x, i) (((x) >> (i)) & 1)
#define all(x) x.begin(), x.end()
using namespace std;
using ll = long long;
template <typename A, typename B>
inline bool ckmax(A& a, const B& b) {
    if (a < b) {
        a = b;
        return true;
    } return false;
}
template <typename A, typename B>
inline bool ckmin(A& a, const B& b) {
    if (a > b) {
        a = b;
        return true;
    } return false;
}
inline void fileIO(const string& Task = "") {
    ios::sync_with_stdio(false); cin.tie(NULL);
    if (fopen((Task + ".inp").c_str(), "r")) {
        freopen((Task + ".inp").c_str(), "r", stdin);
        freopen((Task + ".out").c_str(), "w", stdout);
    }
}

/* Author: Hoang Quoc Viet */

/** END OF TEMPLATE **/

int n, mn = 1e9, sum = 0;

int main() {
    fileIO("main");

    cin >> n;
    FOR(i, 1, n) {
        int x;
        cin >> x;
        ckmin(mn, x);
        sum += x;
    }

    cout << sum + mn * (n - 2);

    return 0;
}

/*** VOI VOI VOI important things must be said three times :> ***/

Compilation message

Main.cpp: In function 'void fileIO(const string&)':
Main.cpp:36:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   36 |         freopen((Task + ".inp").c_str(), "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:37:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   37 |         freopen((Task + ".out").c_str(), "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 4 ms 204 KB Output is correct
3 Incorrect 11 ms 312 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Incorrect 1 ms 324 KB Output isn't correct
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 4 ms 204 KB Output is correct
3 Incorrect 11 ms 312 KB Output isn't correct
4 Halted 0 ms 0 KB -