17222022-12-01 16:48:10MetamorphosesRendőrségi Üldözés 4cpp11Time limit exceeded 0/1002.599s4280 KiB
#include <iostream>

using namespace std;

int main()
{
    int n,r,t,l;
    cin >>n >>r>>t>>l;
    int arr[n];
    for(int i = 0; i < n; i++)
            cin >> arr[i];

    bool zold = true;
    int minlepes = 0;
    for(int i = 0; i < l; i++)
    {
        if((i+1)%t == 0)
            zold = !zold;

        //cout << zold << "\n";
        minlepes++;
        if((i+1) == arr[0]){
            if(zold)
                minlepes+=1;
            else{
                if(!zold){
                    if(r > 0){
                        minlepes++;
                        r--;
                    }
                    else if (r == 0){
                       // cout << "asd";
                        minlepes+=(t - ((i+1)%t));
                    }
                }
            }
        }
        //cout << "i = " << i+1 << '\n';
       // cout << "Minl " << minlepes << '\n';

    }
    cout << minlepes;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted3ms1880 KiB
2Accepted2ms2268 KiB
subtask20/10
3Time limit exceeded2.599s1328 KiB
4Time limit exceeded2.549s2388 KiB
5Time limit exceeded2.549s2632 KiB
6Time limit exceeded2.546s1880 KiB
7Time limit exceeded2.549s2176 KiB
subtask30/15
8Time limit exceeded2.569s2204 KiB
9Time limit exceeded2.562s2972 KiB
10Time limit exceeded2.549s2352 KiB
11Time limit exceeded2.561s2528 KiB
subtask40/15
12Wrong answer2ms3284 KiB
13Wrong answer2ms3280 KiB
14Wrong answer2ms3284 KiB
15Wrong answer2ms3288 KiB
subtask50/25
16Wrong answer2ms3412 KiB
17Wrong answer2ms3640 KiB
18Wrong answer2ms3556 KiB
19Wrong answer2ms3688 KiB
20Wrong answer2ms3892 KiB
subtask60/15
21Time limit exceeded2.599s3020 KiB
22Time limit exceeded2.556s3940 KiB
23Time limit exceeded2.538s3372 KiB
24Time limit exceeded2.573s3444 KiB
25Time limit exceeded2.585s4280 KiB
subtask70/20
26Time limit exceeded2.529s3704 KiB
27Time limit exceeded2.552s3904 KiB
28Time limit exceeded2.581s3924 KiB
29Time limit exceeded2.578s3692 KiB
30Time limit exceeded2.569s3760 KiB