76222024-01-10 09:18:56madvirMI bróker (50 pont)cpp17Time limit exceeded 0/501.1s3696 KiB
#include <iostream>

using namespace std;

int main()
{
    int n, q, v, e;
    cin >> n >> q;
    int ar[n];

    for(int i=0; i<n; i++) {
        cin >> ar[i];
    }

    int tart=0, van=0, h=0;

    for(int i=0; i<q; i++) {
        cin >> v >> e;
        tart=0;
        h=0;
        while(tart<n) {
            if(van==0 && ar[tart]<=v) {
                van=1;
                h=h-ar[tart];
            }
            if(van==1 && ar[tart]>=e) {
                van=0;
                h=h+ar[tart];
            }
            tart++;
        }
        cout << h << endl;
    }

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Accepted0/03ms2024 KiB
2Time limit exceeded0/01.1s1396 KiB
3Wrong answer0/13ms2592 KiB
4Wrong answer0/13ms2700 KiB
5Wrong answer0/23ms2876 KiB
6Wrong answer0/27ms3080 KiB
7Wrong answer0/27ms3080 KiB
8Time limit exceeded0/11.082s2260 KiB
9Time limit exceeded0/11.075s2540 KiB
10Time limit exceeded0/21.062s2484 KiB
11Time limit exceeded0/21.067s2544 KiB
12Time limit exceeded0/21.054s2816 KiB
13Time limit exceeded0/21.067s2764 KiB
14Time limit exceeded0/21.059s3696 KiB
15Time limit exceeded0/31.062s2696 KiB
16Time limit exceeded0/31.042s2844 KiB
17Time limit exceeded0/31.067s2984 KiB
18Time limit exceeded0/31.059s2736 KiB
19Time limit exceeded0/31.062s2816 KiB
20Time limit exceeded0/31.075s2836 KiB
21Time limit exceeded0/31.067s2988 KiB
22Time limit exceeded0/31.07s3068 KiB
23Time limit exceeded0/31.039s2976 KiB
24Time limit exceeded0/31.078s3112 KiB