245132026-02-12 15:19:48tamasnagyFasor (40)cpp17Időlimit túllépés 22/40300ms2332 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
RészfeladatÖsszpontTesztVerdiktIdőMemória
base22/40
1Elfogadva0/01ms316 KiB
2Elfogadva0/04ms316 KiB
3Elfogadva2/21ms500 KiB
4Elfogadva2/21ms316 KiB
5Elfogadva2/21ms316 KiB
6Elfogadva2/21ms316 KiB
7Elfogadva2/21ms316 KiB
8Elfogadva2/22ms500 KiB
9Elfogadva2/24ms436 KiB
10Elfogadva2/24ms488 KiB
11Elfogadva2/24ms316 KiB
12Elfogadva2/23ms388 KiB
13Időlimit túllépés0/2300ms796 KiB
14Időlimit túllépés0/2300ms748 KiB
15Időlimit túllépés0/2298ms1124 KiB
16Időlimit túllépés0/2300ms2332 KiB
17Időlimit túllépés0/2277ms1260 KiB
18Időlimit túllépés0/2277ms1076 KiB
19Időlimit túllépés0/2277ms2324 KiB
20Időlimit túllépés0/2277ms564 KiB
21Időlimit túllépés0/2289ms1076 KiB
22Elfogadva2/271ms1076 KiB