79172024-01-12 00:13:51adamSíkság (55)cpp17Wrong answer 12/55277ms9212 KiB
#include <bits/stdc++.h>

using namespace std;

int main() {
    int length = 0;
    cin >> length;
    vector<int> terrain(length, 0);
    for (int i = 0; i < length; i++) {
        cin >> terrain[i];
    }
    int found_index = -1;
    int found_length = 0;

    for (int i = 0; i < length; i++) {
        int a = i;
        int l = 0;
        while(terrain[i] - terrain[a] == 1 || terrain[i] - terrain[a] == 0) {
            a++;
            l++;
        }
        if(found_length < l) {
            found_index = i;
            found_length = l;
        }

    }
    cout << found_length << " " << found_index + 1;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base12/55
1Accepted0/03ms1848 KiB
2Wrong answer0/025ms2320 KiB
3Accepted2/23ms2264 KiB
4Wrong answer0/23ms2516 KiB
5Accepted2/23ms2728 KiB
6Wrong answer0/23ms2980 KiB
7Wrong answer0/33ms3068 KiB
8Accepted2/23ms3044 KiB
9Accepted3/33ms3112 KiB
10Wrong answer0/323ms3488 KiB
11Accepted3/34ms3808 KiB
12Wrong answer0/3156ms3804 KiB
13Wrong answer0/335ms5360 KiB
14Time limit exceeded0/3266ms4512 KiB
15Time limit exceeded0/3277ms5016 KiB
16Time limit exceeded0/3241ms6660 KiB
17Time limit exceeded0/3259ms6124 KiB
18Time limit exceeded0/3256ms8092 KiB
19Time limit exceeded0/3261ms7776 KiB
20Time limit exceeded0/3273ms8148 KiB
21Time limit exceeded0/3228ms9212 KiB
22Time limit exceeded0/3250ms8964 KiB