QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#461810 | #138. Bali Sculptures | fryan# | 0 | 5ms | 7972kb | C++20 | 1.2kb | 2024-07-03 02:36:58 | 2024-07-03 02:36:59 |
Judging History
answer
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <chrono>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
using namespace std;
#define all(x) begin(x), end(x)
#define sz(x) (int) (x).size()
const int mxn = 101;
const int inf = 1061109567;
int n,a,b,ag[mxn],dp[mxn][mxn][mxn];
int rsq(int l, int r) {
if (l) return ag[r]-ag[l-1];
return ag[r];
}
signed main() {
scanf("%d%d%d",&n,&a,&b);
for (int i=0; i<n; i++) {
scanf("%d",&ag[i]);
if (i) ag[i] += ag[i-1];
}
memset(dp,0x3f,sizeof(dp));
for (int l=0; l<n; l++) {
for (int r=l; r<n; r++) {
dp[l][r][1] = rsq(l,r);
}
}
for (int l=n-1; l>=0; l--) {
for (int r=l; r<n; r++) {
for (int i=1; i<=n; i++) {
if (dp[l][r][i] == inf) continue;
for (int rp=r+1; rp<n; rp++) {
dp[l][rp][i+1] = min(dp[l][rp][i+1], dp[l][r][i] | rsq(r+1,rp));
}
}
}
}
printf("%d",dp[0][n-1][b]);
return 0;
}
詳細信息
Subtask #1:
score: 0
Wrong Answer
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 7964kb
input:
8 1 4 1 2 1 1 1 0 4 6
output:
7
result:
wrong answer 1st lines differ - expected: '6', found: '7'
Subtask #2:
score: 0
Wrong Answer
Test #13:
score: 0
Accepted
time: 1ms
memory: 7796kb
input:
6 2 3 1 1 1 1 1 1
output:
2
result:
ok single line: '2'
Test #14:
score: 0
Accepted
time: 1ms
memory: 7776kb
input:
20 4 7 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
output:
30
result:
ok single line: '30'
Test #15:
score: 0
Accepted
time: 0ms
memory: 7912kb
input:
20 2 2 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
output:
100
result:
ok single line: '100'
Test #16:
score: 0
Accepted
time: 0ms
memory: 7824kb
input:
20 2 7 1 4 8 1 4 4 1 1 2 8 2 2 4 1 1 1 8 2 2 4
output:
13
result:
ok single line: '13'
Test #17:
score: 0
Accepted
time: 0ms
memory: 7908kb
input:
20 5 13 1 4 8 1 2 8 1 1 8 8 8 4 4 2 2 1 2 4 8 1
output:
15
result:
ok single line: '15'
Test #18:
score: 0
Accepted
time: 1ms
memory: 7812kb
input:
6 6 6 0 0 0 1 1 2
output:
3
result:
ok single line: '3'
Test #19:
score: 0
Accepted
time: 1ms
memory: 7904kb
input:
6 3 6 6 5 0 0 0 1
output:
7
result:
ok single line: '7'
Test #20:
score: 0
Accepted
time: 0ms
memory: 7904kb
input:
5 2 3 7 5 6 9 8
output:
15
result:
ok single line: '15'
Test #21:
score: 0
Accepted
time: 1ms
memory: 7968kb
input:
10 2 4 9 6 6 9 6 1 3 2 5 2
output:
15
result:
ok single line: '15'
Test #22:
score: 0
Accepted
time: 1ms
memory: 7968kb
input:
15 15 15 4 9 8 4 5 7 1 5 3 7 10 5 4 2 4
output:
15
result:
ok single line: '15'
Test #23:
score: 0
Accepted
time: 1ms
memory: 7776kb
input:
17 3 3 3 6 7 9 9 5 7 5 6 2 6 2 10 8 7 9 7
output:
43
result:
ok single line: '43'
Test #24:
score: -0
Wrong Answer
time: 1ms
memory: 7908kb
input:
20 4 7 9 8 7 2 10 1 3 2 5 0 10 3 6 5 2 3 10 1 3 5
output:
23
result:
wrong answer 1st lines differ - expected: '19', found: '23'
Subtask #3:
score: 0
Wrong Answer
Test #26:
score: 0
Accepted
time: 1ms
memory: 7968kb
input:
5 1 3 451631570 250518388 397580948 477427142 699144811
output:
1040187263
result:
ok single line: '1040187263'
Test #27:
score: 0
Accepted
time: 1ms
memory: 7912kb
input:
20 1 20 262144 512 33554432 256 16384 32 8388608 2097152 536870912 524288 64 1024 32768 134217728 67108864 2048 4096 128 268435456 1048576
output:
1052565472
result:
ok single line: '1052565472'
Test #28:
score: -0
Wrong Answer
time: 0ms
memory: 7884kb
input:
10 1 4 585497577 747583750 169121856 897466290 878323190 352710279 143784633 220521827 564660939 846262488
output:
-1224736769
result:
wrong answer 1st lines differ - expected: '1877999615', found: '-1224736769'
Subtask #4:
score: 0
Accepted
Test #36:
score: 0
Accepted
time: 1ms
memory: 7904kb
input:
21 1 20 7 2 8 9 5 5 2 8 3 0 5 0 5 9 3 4 1 4 7 7 10
output:
15
result:
ok single line: '15'
Test #37:
score: 0
Accepted
time: 1ms
memory: 7776kb
input:
50 1 10 8 8 6 4 10 8 2 2 5 4 6 3 3 7 2 4 8 1 3 9 9 6 4 4 10 8 1 5 4 10 7 1 6 5 7 5 3 5 9 1 8 4 10 2 10 2 3 1 4 4
output:
31
result:
ok single line: '31'
Test #38:
score: 0
Accepted
time: 1ms
memory: 7776kb
input:
25 1 10 4 0 8 2 7 2 6 9 10 3 4 1 4 8 4 4 7 7 10 9 5 0 8 3 10
output:
23
result:
ok single line: '23'
Test #39:
score: 0
Accepted
time: 0ms
memory: 7824kb
input:
38 1 5 4 8 8 4 5 5 3 7 10 6 1 3 10 3 2 9 7 4 7 3 5 5 10 5 0 3 9 7 9 4 7 7 4 10 7 9 5 6
output:
47
result:
ok single line: '47'
Test #40:
score: 0
Accepted
time: 1ms
memory: 7896kb
input:
42 1 18 1 4 4 7 2 9 5 6 0 1 9 5 3 2 8 0 7 9 8 2 5 6 10 0 10 4 0 5 4 2 3 1 0 1 0 4 4 1 7 4 10 7
output:
15
result:
ok single line: '15'
Test #41:
score: 0
Accepted
time: 1ms
memory: 7908kb
input:
50 1 20 9 8 8 9 10 10 8 9 8 8 9 10 9 8 10 9 9 10 8 10 8 8 10 9 10 10 9 9 9 10 8 8 9 9 10 9 10 8 9 9 8 9 8 9 10 10 9 9 9 9
output:
27
result:
ok single line: '27'
Test #42:
score: 0
Accepted
time: 1ms
memory: 7896kb
input:
50 1 20 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
output:
30
result:
ok single line: '30'
Test #43:
score: 0
Accepted
time: 1ms
memory: 7820kb
input:
50 1 1 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10
output:
500
result:
ok single line: '500'
Test #44:
score: 0
Accepted
time: 1ms
memory: 7832kb
input:
50 1 20 2 2 6 1 8 4 10 1 2 4 1 3 4 5 5 4 2 5 1 4 8 3 9 8 4 6 5 10 6 6 6 2 4 5 8 3 8 1 1 4 4 10 4 4 6 3 7 3 6 8
output:
15
result:
ok single line: '15'
Test #45:
score: 0
Accepted
time: 0ms
memory: 7836kb
input:
50 1 17 4 10 3 4 2 8 6 6 4 2 8 8 5 4 9 4 10 1 4 6 3 8 3 3 8 3 8 9 8 5 5 2 8 3 8 1 9 9 6 1 10 10 8 7 1 9 8 2 5 9
output:
23
result:
ok single line: '23'
Subtask #5:
score: 0
Wrong Answer
Test #46:
score: 0
Accepted
time: 0ms
memory: 7972kb
input:
51 1 20 6 10 12 9 0 3 14 3 0 1 18 20 4 9 7 16 11 15 17 16 10 15 11 1 6 16 19 15 12 17 10 3 6 5 14 6 11 0 18 6 0 2 4 7 7 16 7 9 10 13 0
output:
31
result:
ok single line: '31'
Test #47:
score: 0
Accepted
time: 2ms
memory: 7776kb
input:
65 1 10 4 4 16 20 4 4 1 16 19 7 7 6 7 13 3 17 6 1 18 4 18 11 10 5 6 16 19 12 15 11 1 2 11 9 17 2 3 18 18 4 14 19 6 8 0 16 7 5 17 10 1 12 2 7 17 15 12 13 18 2 12 7 12 8 14
output:
79
result:
ok single line: '79'
Test #48:
score: 0
Accepted
time: 2ms
memory: 7888kb
input:
78 1 23 1 7 6 6 16 19 4 1 3 19 4 11 14 5 11 6 18 15 3 19 1 16 3 11 9 18 4 3 16 5 15 20 19 16 20 15 7 11 4 13 8 5 11 16 5 19 10 0 11 13 16 3 9 13 13 4 9 4 8 18 4 15 15 1 1 2 15 19 9 9 12 14 1 12 10 16 9 1
output:
47
result:
ok single line: '47'
Test #49:
score: 0
Accepted
time: 3ms
memory: 7968kb
input:
91 1 55 17 10 12 19 18 1 10 7 15 15 10 8 1 4 20 1 6 4 11 11 2 3 17 5 20 4 11 6 6 20 1 0 2 5 19 15 9 20 18 1 2 17 14 5 11 14 13 12 11 13 4 16 20 8 13 6 0 7 15 10 15 2 19 17 0 16 17 16 18 2 3 13 12 7 20 6 1 17 6 4 5 19 11 18 5 19 12 17 15 8 11
output:
31
result:
ok single line: '31'
Test #50:
score: 0
Accepted
time: 2ms
memory: 7892kb
input:
100 1 100 14 12 3 1 15 7 6 13 16 16 0 2 12 5 13 6 18 18 3 5 13 14 5 19 12 20 2 1 2 4 13 14 4 13 9 12 4 20 1 10 10 19 10 5 1 7 3 15 9 4 2 9 10 20 15 10 11 13 5 12 2 15 8 1 18 5 7 15 4 11 9 18 20 14 10 8 9 10 18 10 11 0 7 12 6 15 19 0 9 0 15 19 0 2 20 0 9 1 20 17
output:
31
result:
ok single line: '31'
Test #51:
score: 0
Accepted
time: 2ms
memory: 7828kb
input:
100 1 100 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20...
output:
20
result:
ok single line: '20'
Test #52:
score: 0
Accepted
time: 0ms
memory: 7832kb
input:
100 1 1 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2...
output:
2000
result:
ok single line: '2000'
Test #53:
score: -0
Wrong Answer
time: 4ms
memory: 7812kb
input:
100 1 47 18 1 15 15 2 14 19 16 8 19 1 7 12 5 16 1 5 15 13 15 16 20 8 20 9 13 7 19 8 2 4 4 4 17 5 19 19 16 2 5 13 19 9 19 5 14 17 7 12 13 16 8 7 20 10 20 7 14 19 2 9 8 11 18 19 12 9 13 20 16 10 15 9 16 17 6 20 2 19 20 15 20 8 11 12 4 20 18 1 13 8 1 9 16 12 18 17 1 3 19
output:
55
result:
wrong answer 1st lines differ - expected: '47', found: '55'
Subtask #6:
score: 0
Wrong Answer
Test #55:
score: 0
Wrong Answer
time: 1ms
memory: 7880kb
input:
51 1 20 112872931 738945953 683278169 770763749 516510818 790818428 875172481 703986370 60868760 918060338 785761560 775662511 633498896 598270657 590667589 115223551 657182582 662359373 423527461 442741161 404625684 341975402 396747626 126186088 753822361 159840892 743886212 135361223 217348329 815...
output:
-1610612737
result:
wrong answer 1st lines differ - expected: '1879048191', found: '-1610612737'
Subtask #7:
score: 0
Wrong Answer
Test #63:
score: 0
Wrong Answer
time: 3ms
memory: 7824kb
input:
90 45 90 0 0 0 1 1 2 0 0 0 1 1 2 0 0 0 1 1 2 0 0 0 1 1 2 0 0 0 1 1 2 0 0 0 1 1 2 0 0 0 1 1 2 0 0 0 1 1 2 0 0 0 1 1 2 0 0 0 1 1 2 0 0 0 1 1 2 0 0 0 1 1 2 0 0 0 1 1 2 0 0 0 1 1 2 0 0 0 1 1 2
output:
3
result:
wrong answer 1st lines differ - expected: '2', found: '3'
Subtask #8:
score: 0
Wrong Answer
Test #74:
score: 0
Wrong Answer
time: 5ms
memory: 7900kb
input:
101 1 20 109288331 167187936 289459547 455669706 656308194 233503022 562258473 2210429 243994669 58628149 750503963 610269250 29072940 251143410 458350486 696874700 870849343 646709707 646709077 746808795 87439926 187779526 762073671 569489420 380238922 982163795 784978520 933220915 264403502 755738...
output:
-1744830465
result:
wrong answer 1st lines differ - expected: '3221159935', found: '-1744830465'
Subtask #9:
score: 0
Skipped
Dependency #1:
0%
Subtask #10:
score: 0
Skipped
Dependency #1:
0%
Subtask #11:
score: 0
Skipped
Dependency #1:
0%
Subtask #12:
score: 0
Skipped
Dependency #1:
0%
Subtask #13:
score: 0
Skipped
Dependency #1:
0%