-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmk2.cpp
More file actions
70 lines (57 loc) · 1.59 KB
/
mk2.cpp
File metadata and controls
70 lines (57 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include <bits/stdc++.h>
using namespace std;
// #include "ext/pb_ds/assoc_container.hpp"
// #include "ext/pb_ds/tree_policy.hpp"
// Header Files End
#define F first
#define S second
#define all(X) (X).begin(), (X).end()
#define REP(i,a,b) for (int i = a; i<b; i++)
#define S second
#define ii pair<int, int>
#define PB push_back
#define MP make_pair
#define SQ(a) (a)*(a)
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define endl '\n'
// policy based data structure
// using namespace __gnu_pbds;
// template <class T>
// using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// template <class T>
// using omset = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
// find_by_order(k) returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
// void solve() {
// // my code
// }
int main() {
#ifndef ONLINE_JUDGE
//input.txt
freopen("input1.txt", "r", stdin);
//output.txt
freopen("output1.txt", "w", stdout);
#endif
ios_base::sync_with_stdio(false);
cin.tie(0);
//Reconnaissance 2
int n;
cin >> n;
vector<int> a(n);
for (int &i : a) {
cin >> i;
}
int ans = 1e9;
for (int i = 0; i < n; i++) {
ans = min(ans, abs(a[i] - a[(i + 1) % n]));
}
for (int i = 0; i < n; i++) {
if (ans == abs(a[i] - a[(i + 1) % n])) {
cout << i + 1 << " " << ((i + 1) % n) + 1 << "\n";
return 0;
}
}
return 0;
}