申请题解

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

@[dengduck](/user/501947) @[fast_proton](/user/302805) @[heaksicn](/user/343251)
by LX_zxy @ 2024-07-26 19:45:32


谢谢管理,麻烦你们了QwQ
by LX_zxy @ 2024-07-26 19:46:05


@[LX_zxy](/user/569061) 你的做法有一种在[最简做法](https://www.luogu.com.cn/article/ddlcive1)上画蛇添足的美感。
by fast_proton @ 2024-07-26 20:28:29


@[fast_proton](/user/302805) 这个大佬的方法好像更加灵活欸,有些自愧不如QwQ
by LX_zxy @ 2024-07-26 20:30:30


```cpp #include <bits/stdc++.h> using namespace std; struct co { int zhan; int id; }a[135]; int main() { int n; cin >>n; int m=pow(2,n); for(int i = 1;i <= m;i++) { cin >>a[i].zhan; a[i].id=i; } int maxn=0; int ig=0; int il=0; int maxm=0; for(int i = 1;i <= m/2;i++) { maxn=max(a[i].zhan,maxn); if(maxn==a[i].zhan) { il=i; } } for(int i = m/2+1;i <= m;i++) { maxm=max(a[i].zhan,maxm); if(maxm==a[i].zhan) { ig=i; } } if(maxn<maxm) { cout <<il; } else { cout <<ig; } return 0; } ``` 我这个总行了吧,只用到了基本知识,蒟蒻都看得懂
by CZY880201 @ 2024-07-29 09:29:40


@[dengduck](/user/501947) @[fast_proton](/user/302805) @[heaksicn](/user/343251)
by CZY880201 @ 2024-07-29 09:30:34


@[CZY880201](/user/1151812) 不行。
by fast_proton @ 2024-07-29 09:38:08


这个行不行? ```cpp #include<bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; int rn=1; for(int i=0;i<n;i++){ rn*=2; } int guojia[rn+2]={}; int yg[rn+2]={}; for(int i=0;i<rn;i++){ cin>>guojia[i]; yg[i]=i+1; } int cs=2; for(int i=0;i<=n;i++){ for(int j=0;j<=rn;j+=cs){ if(guojia[j]<guojia[j+(cs/2)]){ swap(guojia[j],guojia[j+(cs/2)]); swap(yg[j],yg[j+(cs/2)]); } } cs*=2; } cout<<yg[rn/2-1+1]; return 0; } ```
by SCP3023 @ 2024-08-12 14:49:02


微小模拟
by SCP3023 @ 2024-08-12 14:50:12


@[dengduck](/user/501947) @[fast_proton](/user/302805) @[heaksicn](/user/343251)
by SCP3023 @ 2024-08-12 14:50:23


| 下一页