0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-24 01:08:47 +00:00
OI-codes/Luogu/P4715/P4715.cpp

30 lines
579 B
C++
Raw Normal View History

#include <bits/stdc++.h>
using namespace std;
int main() {
2021-11-19 09:01:13 +00:00
int n, t;
queue<pair<int, int>> q;
cin >> n;
n = 1 << n;
for (int i = 1; i <= n; i++) {
cin >> t;
q.push(make_pair(t, i));
}
while (q.size() > 2) {
pair<int, int> x, y;
x = q.front();
q.pop();
y = q.front();
q.pop();
q.push(x.first > y.first ? x : y);
}
pair<int, int> x, y;
x = q.front();
q.pop();
y = q.front();
q.pop();
cout << (x.first > y.first ? y.second : x.second) << endl;
return 0;
}