1 solutions
-
0
```#include<bits/stdc++.h> using namespace std; int a[100010]; int main(){ int n,p=1,cnt=1; long long t=0; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; } sort(a+1,a+n+1); for(int i=1;i<=n;i++){ if(a[i]==a[i+1]) cnt++; else { t+=(a[i]-p)*6+2+cnt*1+3; cnt=1;p=a[i]; } } t+=(a[n]-1)*4; cout<<t; return 0; }
Information
- ID
- 1058
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 7
- Tags
- # Submissions
- 20
- Accepted
- 8
- Uploaded By