245142026-02-12 15:20:34tamasnagyFasor (40)cpp17Time limit exceeded 22/40291ms1268 KiB
// fak.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
vector<int>fah;
int main()
{
    int n, k;
    cin >> n >> k;
    fah.resize(n);
    for (int i = 0; i < n; i++) {
        cin >> fah[i];
    }
    for (int i = 0; i < n; i++) {
        bool b = 0;
        for (int j = max(0, i - k); j < min(i + k+1, n); j++) {
            if (fah[j] > fah[i]) {
                b = 1;
                break;
            }
        }
        if (!b) {
            cout << i+1;
            break;
        }
    }
}

// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
SubtaskSumTestVerdictTimeMemory
base22/40
1Accepted0/01ms500 KiB
2Accepted0/04ms316 KiB
3Accepted2/21ms316 KiB
4Accepted2/21ms316 KiB
5Accepted2/21ms316 KiB
6Accepted2/21ms316 KiB
7Accepted2/21ms316 KiB
8Accepted2/22ms316 KiB
9Accepted2/24ms500 KiB
10Accepted2/24ms316 KiB
11Accepted2/24ms508 KiB
12Accepted2/23ms316 KiB
13Time limit exceeded0/2277ms564 KiB
14Time limit exceeded0/2277ms564 KiB
15Time limit exceeded0/2277ms1076 KiB
16Time limit exceeded0/2279ms1076 KiB
17Time limit exceeded0/2291ms1096 KiB
18Time limit exceeded0/2291ms1080 KiB
19Time limit exceeded0/2291ms1076 KiB
20Time limit exceeded0/2291ms808 KiB
21Time limit exceeded0/2287ms1076 KiB
22Accepted2/271ms1268 KiB