Submission #321077

#TimeUsernameProblemLanguageResultExecution timeMemory
321077fadi57Safety (NOI18_safety)C++14
0 / 100
54 ms1384 KiB
#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)

safety.cpp: In function 'int main()':
safety.cpp:16:5: warning: unused variable 'equal' [-Wunused-variable]
   16 | int equal=1;
      |     ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...