# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
104585 | 2019-04-08T09:38:49 Z | Hassoony | Simfonija (COCI19_simfonija) | C++17 | 53 ms | 2192 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const ll mod=(1e9+7); const ll inf=(1ll<<61); const int MX=1e5+9; int n,k,a[MX],x; 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",&x),a[i]-=x; sort(a,a+n); x=a[(n-1)/2]; ll ans=0; for(int i=0;i<n;i++){ a[i]-=x; a[i]=abs(a[i]); } sort(a,a+n); for(int i=0;i<n-k;i++){ ans+=a[i]; } cout<<ans<<endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
2 | Correct | 2 ms | 384 KB | Output is correct |
3 | Correct | 2 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 48 ms | 1144 KB | Output is correct |
2 | Correct | 42 ms | 2168 KB | Output is correct |
3 | Correct | 37 ms | 2168 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 41 ms | 1144 KB | Output is correct |
2 | Correct | 38 ms | 2192 KB | Output is correct |
3 | Correct | 39 ms | 2168 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 43 ms | 1144 KB | Output is correct |
2 | Correct | 43 ms | 2168 KB | Output is correct |
3 | Correct | 38 ms | 2168 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 33 ms | 1220 KB | Output is correct |
2 | Correct | 35 ms | 2168 KB | Output is correct |
3 | Incorrect | 34 ms | 2140 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 52 ms | 1152 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 35 ms | 1152 KB | Output is correct |
2 | Incorrect | 42 ms | 2188 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 53 ms | 1208 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 40 ms | 1064 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 42 ms | 988 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |