Skip to content

Instantly share code, notes, and snippets.

@yurahuna
Created September 21, 2016 13:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yurahuna/059452c1da1a82d0a8feb094642f3dc1 to your computer and use it in GitHub Desktop.
Save yurahuna/059452c1da1a82d0a8feb094642f3dc1 to your computer and use it in GitHub Desktop.
signed main() {
std::ios::sync_with_stdio(false);
std::cin.tie(0);
int N, M, A, B;
cin >> N >> M >> A >> B;
vi D(N);
rep(i, N) cin >> D[i];
int i;
for (i = 0; i < N && D[i] >= A; i++) {
;
}
if (N - i < M) {
for (i = i - 1 ; i >= 0 && D[i] <= B; i--) {
;
}
cout << i + 1 << endl;
} else {
cout << i << endl;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment