Submission #696599

#TimeUsernameProblemLanguageResultExecution timeMemory
696599CDuongAutići (COCI22_autici)C++17
50 / 50
12 ms468 KiB
/* #pragma GCC optimize("Ofast,unroll-loops") #pragma GCC target("avx2,fma,bmi,bmi2,sse4.2,popcnt,lzcnt") */ #include <bits/stdc++.h> #define taskname "" #define all(x) x.begin(), x.end() #define ll long long #define ld long double #define pb push_back #define ff first #define ss second #define pii pair<int, int> #define vi vector<int> using namespace std; const int mxN = 3e6 + 5; const int mod = 1e9 + 7; const ll oo = 1e18; int n; ll miin, sum; void solve() { cin >> n; miin = oo; if(n == 1) { cout << 0 << endl; return; } for(int i = 1; i <= n; ++i) { ll tmp; cin >> tmp; sum += tmp; miin = min(miin, tmp); } sum += miin * (ll)(n - 2); cout << sum << endl; } signed main() { #ifndef CDuongg if(fopen(taskname".inp", "r")) assert(freopen(taskname".inp", "r", stdin)), assert(freopen(taskname".out", "w", stdout)); #else freopen("bai3.inp", "r", stdin); freopen("bai3.out", "w", stdout); auto start = chrono::high_resolution_clock::now(); #endif ios_base::sync_with_stdio(false); cin.tie(nullptr); int t = 1; //cin >> t; while(t--) solve(); #ifdef CDuongg auto end = chrono::high_resolution_clock::now(); cout << "\n"; for(int i = 1; i <= 100; ++i) cout << '='; cout << "\nExecution time: " << chrono::duration_cast<chrono::milliseconds> (end - start).count() << "[ms]" << endl; #endif }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...