Submission #104582

#TimeUsernameProblemLanguageResultExecution timeMemory
104582HassoonySimfonija (COCI19_simfonija)C++17
11 / 110
1071 ms1408 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll mod=(1e9+7); const ll inf=(1ll<<61); const int MX=50009; int n,k,a[MX],b[MX],c[MX]; int main(){ cin>>n>>k; for(int i=0;i<n;i++)scanf("%d",&a[i]); for(int i=0;i<n;i++)scanf("%d",&b[i]); for(int i=0;i<n;i++)c[i]=a[i]-b[i]; sort(c,c+n); int x=c[(n-1)/2]; ll ans=0; for(int i=0;i<n;i++){ c[i]-=x; ans+=abs(c[i]); } cout<<ans<<endl; }

Compilation message (stderr)

simfonija.cpp: In function 'int main()':
simfonija.cpp:11:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=0;i<n;i++)scanf("%d",&a[i]);
                         ~~~~~^~~~~~~~~~~~
simfonija.cpp:12:30: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i=0;i<n;i++)scanf("%d",&b[i]);
                         ~~~~~^~~~~~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...