제출 #1124083

#제출 시각아이디문제언어결과실행 시간메모리
1124083Yang8onAutići (COCI22_autici)C++20
0 / 50
6 ms580 KiB
#include <bits/stdc++.h> #define Y8o "Autici" #define maxn (int) 1e5 + 5 #define ll long long #define pii pair<int, int> #define gb(i, j) ((i >> j) & 1) #define all(x) x.begin(), x.end() #define _left id * 2, l, mid #define _right id * 2 + 1, mid + 1, r #define fi(i, a, b) for(int i = a; i <= b; i ++) #define fid(i, a, b) for(int i = a; i >= b; i --) //#define f first //#define s second using namespace std; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count()); ll GetRandom(ll l, ll r) { return uniform_int_distribution<ll> (l, r) (rng); } void iof() { ios_base::sync_with_stdio(0); cin.tie(NULL), cout.tie(NULL); if(fopen(Y8o".inp", "r")) { freopen(Y8o".inp", "r", stdin); // freopen(Y8o".out", "w", stdout); } } void ctime() { cerr << "\n" << "\nTime elapsed: " << 1000 * clock() / CLOCKS_PER_SEC << "ms\n"; } int n; int d[maxn]; void solve() { // cin >> n ; // fi(i, 1, n) { // int x; cin >> x; // mi = min(mi, x), sum += x; // } // cout << 1ll * mi * (n - 1) + sum - mi; cin >> n; fi(i, 1, n) cin >> d[i]; sort( d + 1, d + n + 1 ); if(n == 1) return cout << 0, void(); ll ans = 0; fi(i, 2, n) ans += d[i] + d[0]; cout << ans; } int main() { iof(); int nTest = 1; // cin >> nTest; while(nTest --) { solve(); } ctime(); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

Main.cpp: In function 'void iof()':
Main.cpp:27:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   27 |         freopen(Y8o".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...