Submission #321076

# Submission time Handle Problem Language Result Execution time Memory
321076 2020-11-10T21:14:09 Z fadi57 Safety (NOI18_safety) C++14
0 / 100
54 ms 2020 KB
#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

safety.cpp: In function 'int main()':
safety.cpp:16:5: warning: unused variable 'equal' [-Wunused-variable]
   16 | int equal=1;
      |     ^~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 54 ms 2020 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -