76102024-01-10 09:04:51madvirMI bróker (50 pont)cpp17Time limit exceeded 0/501.1s5840 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, k[q];

    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++;
        }
        k[i]=h;
    }

    for(int i=0; i<q; i++) {
        cout << k[i] << endl;
    }


    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Accepted0/03ms1872 KiB
2Time limit exceeded0/01.1s2044 KiB
3Wrong answer0/13ms2704 KiB
4Wrong answer0/13ms2736 KiB
5Wrong answer0/23ms2740 KiB
6Wrong answer0/27ms3032 KiB
7Wrong answer0/27ms3120 KiB
8Time limit exceeded0/11.1s2980 KiB
9Time limit exceeded0/11.057s2976 KiB
10Time limit exceeded0/21.07s3524 KiB
11Time limit exceeded0/21.054s3420 KiB
12Time limit exceeded0/21.067s3748 KiB
13Time limit exceeded0/21.067s3716 KiB
14Time limit exceeded0/21.054s3768 KiB
15Time limit exceeded0/31.065s4072 KiB
16Time limit exceeded0/31.049s4120 KiB
17Time limit exceeded0/31.062s4468 KiB
18Time limit exceeded0/31.067s4320 KiB
19Time limit exceeded0/31.057s4660 KiB
20Time limit exceeded0/31.082s4924 KiB
21Time limit exceeded0/31.062s5188 KiB
22Time limit exceeded0/31.07s5416 KiB
23Time limit exceeded0/31.074s5568 KiB
24Time limit exceeded0/31.037s5840 KiB