# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1054814 |
2024-08-12T12:21:44 Z |
FaustasK |
Safety (NOI18_safety) |
C++14 |
|
57 ms |
2924 KB |
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, k;
cin >> n >> k;
int M[n];
long long suma = 0;
for(int i = 0; i<n; i++)
{
cin >> M[i];
suma += M[i];
}
double liekana = suma%n;
suma /= n;
liekana /= n;
liekana = round(liekana);
int vidurkis = suma+liekana;
sort(M, M+n);
vidurkis = M[n/2];
//cout << vidurkis << endl;
long long ats = 0;
for(int i = 0; i<n; i++)
{
ats += abs(M[i] - vidurkis);
//cout << ats << ' ';
}
cout << ats;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
404 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
33 ms |
2140 KB |
Output is correct |
2 |
Correct |
47 ms |
2924 KB |
Output is correct |
3 |
Correct |
57 ms |
2900 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |