Submission #548816

#TimeUsernameProblemLanguageResultExecution timeMemory
548816enerelt14Safety (NOI18_safety)C++14
5 / 100
114 ms1040 KiB
#include<bits/stdc++.h> using namespace std; int n, h, s[200005]; int main(){ cin>>n>>h; for (int i=1;i<=n;i++)cin>>s[i]; sort(s+1, s+n+1); long long ans=0; int x=s[n/2+1]; for (int i=1;i<=n;i++)ans+=abs(x-s[i]); cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...