63442023-11-21 12:50:41MrChipserMI bróker (50 pont)cpp11Time limit exceeded 8/501.1s12892 KiB
#include <iostream>

using namespace std;

int main()
{
    int n,m;
    cin >> n >> m;
    int arak[n];
    for(int i = 0; i < n; i++)
        cin >> arak[i];
    int profitok[m] = {0};
    for(int i = 0; i < m; i++)
    {
        int v,e,profit = 0;
        bool van = false;
        cin >> v >> e;
        for(int j = 0; j < n; j++)
        {
            if(!van && arak[j]<=v)
            {
                profit-=arak[j];
                van = true;
            }
            else if(van && arak[j]>=e)
            {
                profit+=arak[j];
                van = false;
            }
        }
        profitok[i]=profit;

    }
    for(int i = 0; i < m; i++)
        cout << profitok[i] << endl;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base8/50
1Accepted0/03ms1880 KiB
2Time limit exceeded0/01.1s2052 KiB
3Accepted1/13ms2692 KiB
4Accepted1/13ms2860 KiB
5Accepted2/23ms3072 KiB
6Accepted2/27ms3216 KiB
7Accepted2/27ms3516 KiB
8Time limit exceeded0/11.1s4204 KiB
9Time limit exceeded0/11.075s5240 KiB
10Time limit exceeded0/21.054s5584 KiB
11Time limit exceeded0/21.057s6308 KiB
12Time limit exceeded0/21.069s7168 KiB
13Time limit exceeded0/21.074s7928 KiB
14Time limit exceeded0/21.057s8344 KiB
15Time limit exceeded0/31.065s8652 KiB
16Time limit exceeded0/31.057s9012 KiB
17Time limit exceeded0/31.1s9700 KiB
18Time limit exceeded0/31.052s10160 KiB
19Time limit exceeded0/31.069s10508 KiB
20Time limit exceeded0/31.077s10956 KiB
21Time limit exceeded0/31.065s11664 KiB
22Time limit exceeded0/31.07s12252 KiB
23Time limit exceeded0/31.065s12660 KiB
24Time limit exceeded0/31.018s12892 KiB