Submission #403636

# Submission time Handle Problem Language Result Execution time Memory
403636 2021-05-13T10:33:18 Z CursedCode Fireworks (APIO16_fireworks) C++14
0 / 100
2000 ms 1740 KB
#include<bits/stdc++.h>
#include<algorithm>
#include<vector>

using namespace std;

int main(){
	int N,M,i,j;
	long long a[100000],b[100000],x = 1000000000,y = 0,ans = 0,ansl = 1000000000;
	cin >> N >> M;
	for(i = 1;i <= N + M - 1;i++){
		cin >> a[i] >> b[i];
		x = min(x,b[i]);
		y = max(y,b[i]);
	}
	for(i = x;i <= y;i++){
		ans = 0;
		for(j = 1;j <= N + M - 1;j++){
			ans += abs(i - b[j]);
		}
		ansl = min(ansl,ans);
	}
	cout << ans;
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1740 KB Output is correct
2 Execution timed out 2094 ms 1740 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 1740 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1740 KB Output is correct
2 Execution timed out 2094 ms 1740 KB Time limit exceeded
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 1740 KB Output is correct
2 Execution timed out 2094 ms 1740 KB Time limit exceeded
3 Halted 0 ms 0 KB -