Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define rep(i, n) for(int i = 0; i < (int)(n); ++i)
- #define pb push_back
- #define ALL(a) begin(a), end(a)
- #define mp make_pair
- #define F first
- #define S second
- typedef long long ll;
- typedef pair<int, int> PI;
- int main(int argc, char *argv[])
- {
- int m, nmin, nmax;
- while(cin >> m >> nmin >> nmax && m){
- vector<int> in(m);
- rep(i, m) cin >> in[i];
- sort(ALL(in));
- reverse(ALL(in));
- PI ans(-1, 0);
- for(int i = nmin - 1; i <= nmax - 1; ++i){
- if(i + 1 < m && in[i] == in[i+1]) continue;
- ans = max(ans, mp(in[i] - in[i+1], i + 1));
- }
- cout << ans.S << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement