Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <vector>
- #include <set>
- using namespace std;
- int main() {
- long long int x, m, n, min1;
- set <pair<long long int, int>> p;
- cin >> n >> m;
- for (int i = 1; i<=n; i++) {
- cin >> x;
- p.insert({ x,i });
- }
- for (int i = 1; i <= m; i++) {
- long long int x, y;
- cin >> x >> y;
- for (auto c: p)
- if (c.second <= y && c.second >= x) {
- cout << c.second << endl;
- break;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement