蒟蒻今天第亿次60pts

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

这道题没那么复杂吧QAQ, 我是直接查找左区间最大值和右区间最大值比较
by AlexFad @ 2021-08-05 13:08:55


```cpp #include<bits/stdc++.h> using namespace std; int a,s,n,lmax,lmaxn,rmax,rmaxn; int main(){ scanf("%d",&n); s=(1<<n); for(int i=1;i<=s/2;i++){ scanf("%d",&a); if(a>lmax){ lmax=a; lmaxn=i; } } for(int i=s/2+1;i<=s;i++){ scanf("%d",&a); if(a>rmax){ rmax=a; rmaxn=i; } } printf("%d",lmax>rmax?rmaxn:lmaxn); return 0; } ```
by AlexFad @ 2021-08-05 13:12:11


|