0
1
mirror of https://git.sb/baoshuo/OI-codes.git synced 2024-11-27 17:56:28 +00:00

P4715 【深基16.例1】淘汰赛

R41389381
This commit is contained in:
Baoshuo Ren 2020-11-06 16:22:55 +08:00 committed by Baoshuo Ren
parent 1ad1d8d5a7
commit e0b7a23c03
Signed by: baoshuo
GPG Key ID: 70F90A673FB1AB68

29
problem/P4715/P4715.cpp Normal file
View File

@ -0,0 +1,29 @@
#include <bits/stdc++.h>
using namespace std;
int main() {
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;
}