# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
321076 | fadi57 | Safety (NOI18_safety) | C++14 | 54 ms | 2020 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;
typedef long long ll;
const int mx=200009;
const int mod= 998244353;
const int inf=2*1e5+9;
ll n,h;
ll a[mx];
int main() {
cin>>n>>h;ll sum=0;
for(int i=0;i<n;i++){
cin>>a[i];sum+=a[i];
}
int equal=1;
ll ans=0;
ll mxx= 1e9;
mxx=mxx*mx;ans=mxx;
ans=n*a[0];ans=abs(ans-sum);
for(int i=1;i<n;i++){
ans=min(ans,abs(a[i]*n-sum));}
cout<<ans;
}
Compilation message (stderr)
# | 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... |