编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#16517 #1070. youngmagician's victory is made of numerous duplicates of himself and stop ak Accepted 100 403 ms 16852 K C++ 17 / 882 B C192023212361 2024-03-16 16:24:59
显示原始代码
#include <bits/stdc++.h>
#define endl '\n'

#define Endl endl

#define rt return

#define int long long

using namespace std;
const int mod = 998244353;
const int maxn = 1 << 22;
int a[maxn];
int maxx;
int n;
int dfs(int idx) {
    if (idx * 2 >= (1ll << (n + 1)))
        rt a[idx];
    if (idx * 2 < (1ll << (n + 1)) && a[idx * 2] == 0)
        dfs(idx * 2);
    if (idx * 2 + 1 < (1ll << (n + 1)) && a[idx * 2 + 1] == 0)
        dfs(idx * 2 + 1);
    a[idx] = max(a[idx * 2], a[idx * 2 + 1]);
    rt a[idx];
}
int dfn(int idx, int cnt = 0) {
    if (a[idx] == 1)
        rt cnt;
    if (idx * 2 >= (1ll << (n + 1)))
        rt cnt;
    else
        rt min(dfn(idx * 2, cnt + 1), dfn(idx * 2 + 1, cnt + 1));
}
signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    int cnt = 0;
    maxx = n;
    for (int i = 1ll << n; i < (1ll << (n + 1)); i++) {
        int tp;
        cin >> a[i];
    }
    dfs(1);
    cout << "we are top " << (long long)pow(2ll, dfn(1)) << " !";
    rt 0;
}
子任务 #1
Accepted
得分:100
测试点 #1
Accepted
得分:100
用时:5 ms
内存:492 KiB

输入文件(1.in

13 
1 5372 18675 1 1 1 1 28309 16157 29464 1 4851 1 1 23730 31847 1 1296 4483 1 1 1 1 21487 1 1 1 3
<36162 bytes omitted>

答案文件(1.out

we are top 2048 !

用户输出

we are top 2048 !

系统信息

Exited with return code 0
测试点 #2
Accepted
得分:100
用时:7 ms
内存:412 KiB

输入文件(2.in

2 
13252 14051 1 19573 

答案文件(2.out

we are top 4 !

用户输出

we are top 4 !

系统信息

Exited with return code 0
测试点 #3
Accepted
得分:100
用时:7 ms
内存:840 KiB

输入文件(3.in

15 
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
<65441 bytes omitted>

答案文件(3.out

we are top 1 !

用户输出

we are top 1 !

系统信息

Exited with return code 0
测试点 #4
Accepted
得分:100
用时:176 ms
内存:16748 KiB

输入文件(4.in

20 
1 1 1 1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000 1 1000000
<11534241 bytes omitted>

答案文件(4.out

we are top 131072 !

用户输出

we are top 131072 !

系统信息

Exited with return code 0
测试点 #5
Accepted
得分:100
用时:208 ms
内存:16852 KiB

输入文件(5.in

20 
1000000000000000000 1000000000000000000 1000000000000000000 1000000000000000000 100000000000000
<16252833 bytes omitted>

答案文件(5.out

we are top 262144 !

用户输出

we are top 262144 !

系统信息

Exited with return code 0