-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy pathASHMHF.cpp
43 lines (36 loc) · 831 Bytes
/
ASHMHF.cpp
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
//
// main.cpp
// practice
//
// Created by Mahmud on 7/17/18.
// Copyright © 2018 Mahmud. All rights reserved.
//
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <utility>
using namespace std;
const int S = 100005;
int T, N;
pair<int, int> data[S];
int main() {
scanf("%d", &T);
for (int _ = 0; _ < T; _ ++) {
scanf("%d", &N);
for (int i = 1; i <= N; i ++) {
scanf("%d", &data[i].first);
data[i].second = i;
}
sort(data + 1, data + N + 1);
int result = -1;
if (N & 1) {
result = data[(N >> 1) + 1].second;
}
else {
result = min(data[N >> 1].second, data[(N >> 1) + 1].second);
}
printf("Case %d: %d\n", _ + 1, result);
}
return 0;
}