#include<iostream>
using namespace std;
int n;
struct Team
{
int sequence;
int capability;
}a[8][130];
int main()
{
cin >> n;
int m = 1 << n;
for (int i = 0; i < m; i++)
{
cin >> a[0][i].capability;
a[0][i].sequence = i;
}
for (int i = 0; i < n - 1; i++)
for (int j = 0, k = 0; j < m; j += 2, k++)
if (a[i][j].capability < a[i][j + 1].capability)
a[i + 1][k] = a[i][j + 1];
else
a[i + 1][k] = a[i][j];
if (a[n - 1][0].capability < a[n - 1][1].capability)
cout << a[n - 1][0].sequence + 1;
else
cout << a[n - 1][1].sequence + 1;
return 0;
}
洛谷P4715 【深基16.例1】淘汰赛进阶解法
最新推荐文章于 2022-08-08 16:55:45 发布