Submission #531177

#TimeUsernameProblemLanguageResultExecution timeMemory
531177KazamaHoangAutići (COCI22_autici)C++14
50 / 50
13 ms316 KiB
// 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; ll sum = 0; int main() { fileIO("main"); cin >> n; FOR(i, 1, n) { int x; cin >> x; ckmin(mn, x); sum += x; } cout << sum + (ll)mn * (n - 2); return 0; } /*** VOI VOI VOI important things must be said three times :> ***/

Compilation message (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...