114342024-09-20 09:38:33madvirMI bróker (50 pont)cpp17Time limit exceeded 0/501.098s1080 KiB
#include <iostream>

using namespace std;

int pret[10000];

int main()
{

    int n, q, ki=0, be=0, profit;
    cin >> n >> q;
    for(int i=0; i<n; i++) {
        cin >> pret[i];
    }
    int v, e, van=0;
    for(int i=0; i<q; i++) {
        cin >> v >> e;
        be=0;
        ki=0;
        for(int j=0; j<n; j++) {
            if(van==0 && (pret[j]<v || pret[j]==v)){
                ki+=pret[j];
                van=1;
            }
            if(van==1 && (pret[j]>e|| pret[j]==e)) {
                be+=pret[j];
                van=0;
            }
        }
        profit=be-ki;
        cout << profit << endl;
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/50
1Accepted0/03ms400 KiB
2Time limit exceeded0/01.092s1000 KiB
3Wrong answer0/13ms360 KiB
4Wrong answer0/13ms528 KiB
5Wrong answer0/23ms504 KiB
6Wrong answer0/27ms360 KiB
7Wrong answer0/27ms372 KiB
8Time limit exceeded0/11.097s940 KiB
9Time limit exceeded0/11.093s1080 KiB
10Time limit exceeded0/21.098s880 KiB
11Time limit exceeded0/21.098s868 KiB
12Time limit exceeded0/21.095s960 KiB
13Time limit exceeded0/21.093s904 KiB
14Time limit exceeded0/21.093s984 KiB
15Time limit exceeded0/31.097s1004 KiB
16Time limit exceeded0/31.098s924 KiB
17Time limit exceeded0/31.093s892 KiB
18Time limit exceeded0/31.093s916 KiB
19Time limit exceeded0/31.098s1000 KiB
20Time limit exceeded0/31.093s1056 KiB
21Time limit exceeded0/31.093s1000 KiB
22Time limit exceeded0/31.093s1000 KiB
23Time limit exceeded0/31.098s1000 KiB
24Time limit exceeded0/31.098s1000 KiB