-
Notifications
You must be signed in to change notification settings - Fork 0
/
CodeTon 1 A
46 lines (38 loc) · 947 Bytes
/
CodeTon 1 A
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
#include <bits/stdc++.h>
#define pi 3.141592653589793238462
#define mod 1000000007
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define all(v) v.begin(), v.end()
#define acc(v) accumulate(all(v), 0)
#define isort(v) sort(all(v))
#define dsort(v) sort(v.rbegin(), v.rend())
#define in(v) for(auto &i : v) cin >> i
#define out(v) for(auto &i : v) cout << i << ' '
using namespace std;
void solve(){
int n;
cin >> n;
vll v(n);
in(v);
if(n == 1) cout << "1 1\n";
else if(n == 2) cout << "1 2\n";
else{
vector< pair<int, int> > vp(n);
for(int i = 0; i < n; i++){
vp[i].first = v[i];
vp[i].second = i + 1;
}
isort(vp);
cout << vp[0].second << " " << vp[n - 1].second << "\n";
}
}
int main(){
ios_base::sync_with_stdio(false); cin.tie(0);
int t = 1;
cin >> t; // Comment this line if there is only one TC
while(t--) solve();
return 0;
}