# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1054192 |
2024-08-12T07:27:56 Z |
unnick |
Safety (NOI18_safety) |
C++14 |
|
79 ms |
3020 KB |
#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 time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
348 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Runtime error |
0 ms |
348 KB |
Execution failed because the return code was nonzero |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
348 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
32 ms |
2772 KB |
Output is correct |
2 |
Correct |
52 ms |
3020 KB |
Output is correct |
3 |
Correct |
79 ms |
3020 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
348 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
348 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
348 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
348 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
348 KB |
Execution failed because the return code was nonzero |
2 |
Halted |
0 ms |
0 KB |
- |