# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1018574 | vjudge1 | Autići (COCI22_autici) | C++17 | 34 ms | 2016 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define int long long
#define endl ('\n')
constexpr long long inf = 1e18;
using namespace std;
bool vis[100001];
int32_t main(){
int n,ans=0;
cin>>n;
vector<pair<int,int>> a(n);
for(int i=0;i<n;i++){
cin>>a[i].first;
a[i].second=i;
}
sort(a.begin(),a.end());
for(int i=1;i<n;i++){
if(!vis[a[i].second])
ans+=a[i].first;
ans+=a[0].first;
vis[a[i].second]=1;
vis[a[0].second]=1;
}
cout<<ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |