# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1216702 | lizi14 | Boxes with souvenirs (IOI15_boxes) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
using namespace std;
int main(){
int n,l,k;
cin>>n>>k>>l;
int x[l];
fill(x,x+l,0);
for(int i=0; i<n; i++){
int j;
cin>>j;
x[j]=1;
}
int ans=0;
for(int i=1; i<l; i++){
if(x[i]==1){
ans+=min(i,l-i);
}
}
cout<<ans*2;
}