352021-01-08 20:04:56mraronHáromszögekcpp11Time limit exceeded 6/40481ms2032 KiB
#include <iostream>

using namespace std;

int N, Q, a, b, l, r;
int t[100000];

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    cin >> N >> Q;
    for(int i=0; i<N; i++) cin >> t[i];

    for(int i=0; i<Q; i++){
        cin >> a >> b;
        l = max(a,b)-min(a,b); r = a+b;
        int db = 0;
        for(int j=0; j<N; j++){
            if(t[j]>l && t[j]<r) db++;
        }
        cout << db << '\n';
    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base6/40
1Accepted0/02ms1820 KiB
2Accepted0/01ms1852 KiB
3Accepted0/0118ms2032 KiB
4Accepted4/44ms1924 KiB
5Accepted2/24ms1924 KiB
6Time limit exceeded0/1435ms1396 KiB
7Time limit exceeded0/1432ms1408 KiB
8Time limit exceeded0/2481ms1532 KiB
9Time limit exceeded0/2426ms1412 KiB
10Time limit exceeded0/1428ms1400 KiB
11Time limit exceeded0/1430ms1400 KiB
12Time limit exceeded0/2444ms1400 KiB
13Time limit exceeded0/2411ms1404 KiB
14Time limit exceeded0/1426ms1400 KiB
15Time limit exceeded0/1437ms1460 KiB
16Time limit exceeded0/1432ms1396 KiB
17Time limit exceeded0/1435ms1460 KiB
18Time limit exceeded0/1425ms1400 KiB
19Time limit exceeded0/2435ms1392 KiB
20Time limit exceeded0/2416ms1404 KiB
21Time limit exceeded0/3418ms1408 KiB
22Time limit exceeded0/5435ms1400 KiB
23Time limit exceeded0/5462ms1460 KiB