# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1054814 | FaustasK | Safety (NOI18_safety) | C++14 | 57 ms | 2924 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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);
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |