Source Code
#include <iostream>
#include <algorithm>
using namespace std;
const int size = 100001;
int loki [size];


int main(){
  int ans=0;
  int n;
  int k;

  cin >> n ;
  cin >> k;

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

  for (int i=0; i<n;i++){
    ans =max (ans,loki[i+k]);
  }
  cout<<ans+1<<endl;


  
}
Copy
Offer King_Of_Asgard
GNU G++17
0 ms
0 KB
Compilation Error