Submission #249235

# Submission time Handle Problem Language Result Execution time Memory
249235 2020-07-14T13:59:09 Z sahil_k Fireworks (APIO16_fireworks) C++14
0 / 100
0 ms 256 KB
#include <iostream>
#include <cmath>
using namespace std;
int n, m;
int main () {
	cin >> n >> m;
	int a[m];
	for (int i=0; i<m; i++) {
		cin >> a[i];
	}
	long long o = 1e16;
	for (int i=0; i<m; i++) {
		long long cur = 0;
		for (int j=0; j<m; j++) {
			cur += abs(a[i]-a[j]);
		}
		o = min(o, cur);
	}
	cout << o << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Incorrect 0 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Incorrect 0 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 256 KB Output is correct
2 Incorrect 0 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -