Submission #733345

#TimeUsernameProblemLanguageResultExecution timeMemory
733345onepunchac168Autići (COCI22_autici)C++14
50 / 50
25 ms2084 KiB
// created by Dinh Manh Hung // onepunchac168 // THPT CHUYEN HA TINH // HA TINH, VIET NAM #include <bits/stdc++.h> using namespace std; //#pragma GCC optimize("O3,unroll-loops,no-stack-protector") //#pragma GCC target("sse4,avx2,fma") #define task "" #define ldb long double #define pb push_back #define fi first #define se second #define pc pop_back() #define all(x) begin(x),end(x) #define uniquev(v) v.resize(unique(all(v))-v.begin()) #define FOR(i,a,b) for (int i=a;i<=b;i++) #define cntbit(v) __builtin_popcountll(v) #define gcd(a,b) __gcd(a,b) #define lcm(a,b) ((1LL*a*b)/__gcd(a,b)) #define mask(x) (1LL<<(x)) #define readbit(x,i) ((x>>i)&1) #define ins insert typedef long long ll; typedef pair <ll,ll> ii; typedef pair <ll,ii> iii; typedef pair <ii,ii> iiii; ll dx[]= {1,-1,0,0,1,-1,1,-1}; ll dy[]= {0,0,-1,1,1,-1,-1,1}; const ldb PI = acos (-1); //const ll mod=978846151; //const ll base=29; const int maxn=1e6+5; const int mod=1e9+7; const char nl = '\n'; inline int ReadInt() { char co; for (co = getchar(); co < '0' || co > '9'; co = getchar()); int xo = co - '0'; for (co = getchar(); co >= '0' && co <= '9'; co = getchar()) xo = xo * 10 + co - '0'; return xo; } void WriteInt(int xo) { if (xo > 9) WriteInt(xo / 10); putchar(xo % 10 + '0'); } /* END OF TEMPLATE*/ // ================= Solution =================// ll n; ll a[100005]; void optmushnpr() { cin>>n; for (int i=1;i<=n;i++) { cin>>a[i]; } sort (a+1,a+n+1); ll sum=0; for (int i=2;i<=n;i++) { sum+=a[1]+a[i]; } cout<<sum; } signed main() { ios_base::sync_with_stdio(false); cin.tie(0); if (fopen(task".inp","r")){ freopen(task".inp","r",stdin); freopen(task".out","w",stdout);} int t; t=1; //cin>>t; while (t--){optmushnpr();} } // goodbye see ya

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:83:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   83 |     freopen(task".inp","r",stdin);
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
Main.cpp:84:12: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   84 |     freopen(task".out","w",stdout);}
      |     ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...