218682026-01-14 09:36:31sandormeszicsFasor (40)cpp17Runtime error 0/403ms564 KiB
#include <iostream>

using namespace std;

int boldog(int a[1000], int n, int k){
    for(int i = 0; i < n; i++){
        bool b = false;
        for(int j = 0; j < k; j++){
            if(i > j){
                if(a[i]-a[j] > k){
                    b = true;
                }
            }
            if(!(b && a[i]+a[j] > k)){
                b = false;
            }
        }
        if(b){
            return i+1;
        }
    }
    return -1;
}

int main()
{
    int a[1000], n, k;
    cin >> n >> k;

    for(int i = 0; i < n; i++){
        cin >> a[i];
    }

    cout << boldog(a, n, k);


    return 0;
}
SubtaskSumTestVerdictTimeMemory
base0/40
1Accepted0/01ms316 KiB
2Runtime error0/02ms316 KiB
3Wrong answer0/21ms316 KiB
4Wrong answer0/21ms316 KiB
5Wrong answer0/21ms316 KiB
6Wrong answer0/21ms316 KiB
7Wrong answer0/21ms316 KiB
8Runtime error0/22ms508 KiB
9Runtime error0/22ms508 KiB
10Runtime error0/23ms564 KiB
11Runtime error0/22ms316 KiB
12Runtime error0/21ms316 KiB
13Runtime error0/22ms316 KiB
14Runtime error0/22ms396 KiB
15Runtime error0/22ms396 KiB
16Runtime error0/22ms316 KiB
17Runtime error0/22ms508 KiB
18Runtime error0/22ms316 KiB
19Runtime error0/22ms508 KiB
20Runtime error0/21ms316 KiB
21Runtime error0/22ms316 KiB
22Runtime error0/22ms316 KiB