82292024-01-12 22:16:10CWMHáromszögekcpp17Wrong answer 5/40179ms4096 KiB
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <climits>

using namespace std;
signed main()
{
	int n, m;
	cin >> n >> m;
	vector<int> lenghts(n);
	for (size_t i = 0; i < n; i++)
	{
		cin >> lenghts[i];
	}
	sort(lenghts.begin(), lenghts.end());
	for (size_t i = 0; i < m; i++)
	{
		int a, b;
		cin >> a >> b;
		int res1 = 0;
		if (lenghts[0] <= abs(a - b)) {
			res1 = *lower_bound(lenghts.begin(), lenghts.end(), abs(a - b));
		}
		int res2 = lenghts.size();
		if (lenghts[lenghts.size() - 1] >= a + b) {
			res2 = *lower_bound(lenghts.begin(), lenghts.end(), abs(a + b));
		}
		cout << res2 - res1 << "\n";
	}
}
SubtaskSumTestVerdictTimeMemory
base5/40
1Accepted0/03ms1812 KiB
2Wrong answer0/03ms2004 KiB
3Wrong answer0/016ms2284 KiB
4Wrong answer0/44ms2460 KiB
5Wrong answer0/24ms2696 KiB
6Wrong answer0/1159ms3504 KiB
7Accepted1/1146ms3692 KiB
8Accepted2/2143ms3756 KiB
9Accepted2/2146ms3740 KiB
10Wrong answer0/1137ms3740 KiB
11Wrong answer0/1136ms3864 KiB
12Wrong answer0/2137ms3744 KiB
13Wrong answer0/2140ms3892 KiB
14Wrong answer0/1166ms3744 KiB
15Wrong answer0/1152ms4020 KiB
16Wrong answer0/1152ms4096 KiB
17Wrong answer0/1150ms3888 KiB
18Wrong answer0/1142ms3892 KiB
19Wrong answer0/2141ms3888 KiB
20Wrong answer0/2143ms3888 KiB
21Wrong answer0/3179ms3888 KiB
22Wrong answer0/5165ms3888 KiB
23Wrong answer0/5168ms3892 KiB