用户输出
23
系统信息
Exited with return code 0
编号 | 题目 | 状态 | 分数 | 总时间 | 内存 | 代码 / 答案文件 | 提交者 | 提交时间 |
---|---|---|---|---|---|---|---|---|
#101533 | #1432. [L2-1] 树木加固 | Accepted | 100 | 248 ms | 4500 K | C++ / 336 B | wyhao | 2024-03-13 0:47:25 |
#include <bits/stdc++.h>
using namespace std;
const int N = 2000005;
int n;
int f[N];
int main() {
scanf("%d", &n);
n = (1 << n);
for (int i = 1; i < n; i++) {
scanf("%d", &f[i]);
}
int ans = 0;
for (int i = n - 1; i; i--) {
ans += abs(f[i]);
f[i / 2] += f[i];
}
printf("%d", ans);
return 0;
}
用户输出
11887
系统信息
Exited with return code 0
用户输出
8158
系统信息
Exited with return code 0
8
114
-808 -998
-826 -984 316 9
-510 -266 401 -830 860 388 -560 -918
67 -319 -972 -451 -30 267 -
<1036 bytes omitted>
用户输出
272319
系统信息
Exited with return code 0
8
-822
-975 757
984 -999 989 -284
81 981 -308 998 -596 395 -673 -738
889 -780 -353 448 -788 -492
<1037 bytes omitted>
用户输出
255014
系统信息
Exited with return code 0
8
-646
-115 -20
-448 712 -920 618
-28 -977 317 160 -621 970 -994 -326
-738 446 -103 -190 218 958
<1037 bytes omitted>
用户输出
273545
系统信息
Exited with return code 0
8
-26
-528 -860
-580 687 -902 680
-997 -939 858 -150 43 977 -605 813
-732 128 28 -68 693 -525 31
<1035 bytes omitted>
用户输出
259605
系统信息
Exited with return code 0
20
53
-291 14
-319 278 -699 -876
-867 947 653 -677 138 359 -47 -702
-112 341 -445 -435 -312 -450
<2176336 bytes omitted>
用户输出
37703792
系统信息
Exited with return code 0
20
-654
-404 -914
-142 819 -993 -963
42 -707 292 -964 -857 408 -33 -731
-877 -2 515 206 877 952
<2176313 bytes omitted>
用户输出
38042269
系统信息
Exited with return code 0