Submission #116788

# Submission time Handle Problem Language Result Execution time Memory
116788 2019-06-13T20:28:15 Z ioilolcom Simfonija (COCI19_simfonija) C++14
0 / 110
30 ms 3020 KB
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
typedef long long int ll;
vector<int>a,b,c;
int main()
{

	ios_base:: sync_with_stdio(false); cin.tie(0);
	int n; cin>>n; int k; cin>>k;
	c.resize(n+1);
	a.resize(n+1);
	b.resize(n+1);
	for(int i=1; i<=n; i++) {
		cin>>a[i];
	}
	for(int i=1; i<=n; i++) {
		cin>>b[i];
		c[i]=abs(a[i]-b[i]);
	}
	sort(c.begin()+1,c.end());
	int m=c[n/2+(n%2)];
	ll sum=0;
	for(int i=1; i<=n; i++) {
		sum+=abs(c[i]-m);
	}
	cout<<sum<<endl;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 2944 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 29 ms 2944 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 3020 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 2304 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 2976 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 2944 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 2940 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 2936 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 27 ms 2944 KB Output isn't correct
2 Halted 0 ms 0 KB -