J. youngmagician's victory is made of numerous duplicates of himself and stop ak 简单题,题意为最常见的单轮淘汰锦标赛,战力为1的是Youngmagician,同样模拟这个过程即可。
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll n;
ll fp[32][100500];
int main() {
ll id;
scanf("%lld", &n);
for (ll x = 0; x < (1 << n); x++) {
scanf("%lld", &id);
fp[0][x] = id;
}
ll ans = 0;
for (ll x = 1; x <= n; x++) {
for (ll y = 0; y < (1 << (n - x + 1)); y++) {
fp[x][y] = max(fp[x - 1][2 * y], fp[x - 1][2 * y + 1]);
if (fp[x][y] == 1) {
ans = max(ans, x);
}
}
}
ans = (1 << (n - ans));
cout << "we are top " << ans << " !";
return 0;
}