Submission #1054192

#TimeUsernameProblemLanguageResultExecution timeMemory
1054192unnickSafety (NOI18_safety)C++14
5 / 100
79 ms3020 KiB
#include <iostream> #include <vector> #include <algorithm> using namespace std; typedef long long int ll; int main() { int n, h; cin >> n >> h; if (h != 0) return 1; vector<int> a; ll sum = 0; for (int i = 0; i < n; i++) { int tmp; cin >> tmp; a.push_back(tmp); } sort(a.begin(), a.end()); int p = a[a.size() / 2]; for (auto v : a) { sum += abs(v-p); } cout << sum << "\n"; }
#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...