QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#489771#8811. Heat Strokebambam#7 534ms3808kbC++17720b2024-07-25 00:33:202024-07-25 00:33:20

Judging History

你现在查看的是最新测评结果

  • [2024-07-25 00:33:20]
  • 评测
  • 测评结果:7
  • 用时:534ms
  • 内存:3808kb
  • [2024-07-25 00:33:20]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);

    int k;
    cin >> k;
    vector<int> c(k);
    for (auto& i : c) cin >> i;
    int n;
    cin >> n;
    vector<int> x(n);
    for (auto& i : x) cin >> i, --i;
    int ans = 0;
    for (int mask = 0; mask < (1 << n); ++mask) {
        auto d = c;
        int cur = 0;
        for (int i = 0; i < n; ++i) {
            int d1 = (mask >> i & 1);
            int d2 = d1 ^ 1;
            if (c[x[i] + d1] > 0) c[x[i] + d1]--;
            else if (c[x[i] + d2] > 0) c[x[i] + d2]--;
            else cur++;
        }
        ans = max(ans, cur);
        c = d;
    }
    cout << ans;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Time Limit Exceeded

Test #1:

score: 6
Accepted
time: 0ms
memory: 3608kb

input:

2
0 0
1
1

output:

1

result:

ok single line: '1'

Test #2:

score: 6
Accepted
time: 0ms
memory: 3588kb

input:

2
0 1
1
1

output:

0

result:

ok single line: '0'

Test #3:

score: 6
Accepted
time: 0ms
memory: 3740kb

input:

2
1 0
1
1

output:

0

result:

ok single line: '0'

Test #4:

score: 6
Accepted
time: 0ms
memory: 3612kb

input:

2
1 1
1
1

output:

0

result:

ok single line: '0'

Test #5:

score: 6
Accepted
time: 0ms
memory: 3808kb

input:

2
2 2
1
1

output:

0

result:

ok single line: '0'

Test #6:

score: 6
Accepted
time: 0ms
memory: 3624kb

input:

2
1 1
2
1 1

output:

0

result:

ok single line: '0'

Test #7:

score: 6
Accepted
time: 0ms
memory: 3596kb

input:

2
2 2
2
1 1

output:

0

result:

ok single line: '0'

Test #8:

score: 6
Accepted
time: 0ms
memory: 3516kb

input:

2
3 3
2
1 1

output:

0

result:

ok single line: '0'

Test #9:

score: 0
Time Limit Exceeded

input:

2
298 299
600
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 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 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 ...

output:


result:


Subtask #2:

score: 7
Accepted

Test #33:

score: 7
Accepted
time: 0ms
memory: 3476kb

input:

3
1 1 1
3
1 2 1

output:

1

result:

ok single line: '1'

Test #34:

score: 7
Accepted
time: 0ms
memory: 3780kb

input:

3
1 1 1
3
2 1 2

output:

1

result:

ok single line: '1'

Test #35:

score: 7
Accepted
time: 0ms
memory: 3524kb

input:

7
1 1 1 1 1 1 1
8
2 1 6 5 4 3 2 6

output:

3

result:

ok single line: '3'

Test #36:

score: 7
Accepted
time: 0ms
memory: 3592kb

input:

8
1 1 1 1 1 1 1 1
10
6 7 4 1 2 3 4 5 6 1

output:

4

result:

ok single line: '4'

Test #37:

score: 7
Accepted
time: 1ms
memory: 3740kb

input:

18
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
13
13 17 13 9 15 4 12 11 12 7 5 15 1

output:

1

result:

ok single line: '1'

Test #38:

score: 7
Accepted
time: 2ms
memory: 3780kb

input:

18
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
15
17 12 6 3 15 17 3 10 6 12 15 17 11 12 14

output:

3

result:

ok single line: '3'

Test #39:

score: 7
Accepted
time: 3ms
memory: 3608kb

input:

18
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
16
16 11 13 10 5 3 10 6 13 16 16 2 14 9 9 3

output:

4

result:

ok single line: '4'

Test #40:

score: 7
Accepted
time: 6ms
memory: 3588kb

input:

18
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
17
12 5 4 1 10 6 8 8 16 6 12 14 7 14 17 12 9

output:

4

result:

ok single line: '4'

Test #41:

score: 7
Accepted
time: 12ms
memory: 3808kb

input:

18
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
18
14 9 3 16 9 2 2 9 4 10 12 17 13 10 10 10 3 11

output:

7

result:

ok single line: '7'

Test #42:

score: 7
Accepted
time: 11ms
memory: 3808kb

input:

17
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
18
15 9 6 3 13 9 13 16 7 5 8 1 1 9 9 15 16 1

output:

5

result:

ok single line: '5'

Test #43:

score: 7
Accepted
time: 10ms
memory: 3540kb

input:

16
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
18
13 4 8 8 13 8 1 15 3 6 4 8 6 4 12 9 15 14

output:

5

result:

ok single line: '5'

Test #44:

score: 7
Accepted
time: 13ms
memory: 3520kb

input:

15
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
18
1 10 3 3 9 6 4 8 3 12 12 11 7 14 6 5 3 3

output:

6

result:

ok single line: '6'

Test #45:

score: 7
Accepted
time: 9ms
memory: 3520kb

input:

13
1 1 1 1 1 1 1 1 1 1 1 1 1
18
11 5 4 8 12 2 1 3 8 8 9 4 12 7 12 3 6 6

output:

7

result:

ok single line: '7'

Test #46:

score: 7
Accepted
time: 17ms
memory: 3616kb

input:

13
1 1 1 1 1 1 1 1 1 1 1 1 1
18
1 2 1 3 4 3 5 6 5 7 8 7 9 10 9 11 12 11

output:

6

result:

ok single line: '6'

Test #47:

score: 7
Accepted
time: 20ms
memory: 3524kb

input:

18
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
18
1 5 7 11 13 17 2 4 8 10 14 16 1 5 7 11 13 17

output:

6

result:

ok single line: '6'

Test #48:

score: 7
Accepted
time: 2ms
memory: 3520kb

input:

16
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
15
1 3 2 4 6 5 7 9 8 10 12 11 13 15 14

output:

5

result:

ok single line: '5'

Test #49:

score: 7
Accepted
time: 15ms
memory: 3532kb

input:

18
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
18
1 1 2 4 5 4 7 8 8 11 10 10 14 13 14 17 17 16

output:

4

result:

ok single line: '4'

Test #50:

score: 7
Accepted
time: 0ms
memory: 3472kb

input:

16
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
12
1 2 3 5 7 6 10 9 11 15 14 13

output:

1

result:

ok single line: '1'

Subtask #3:

score: 0
Time Limit Exceeded

Dependency #2:

100%
Accepted

Test #51:

score: 7
Accepted
time: 0ms
memory: 3596kb

input:

18
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
33
17 17 16 16 15 15 14 14 13 13 12 12 11 11 10 10 9 9 8 8 7 7 6 6 5 5 4 4 3 3 2 2 1

output:

15

result:

ok single line: '15'

Test #52:

score: 7
Accepted
time: 52ms
memory: 3460kb

input:

18
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
20
16 6 17 10 14 2 12 6 12 16 9 16 1 1 8 16 15 1 5 6

output:

7

result:

ok single line: '7'

Test #53:

score: 7
Accepted
time: 534ms
memory: 3588kb

input:

18
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
23
6 4 16 11 16 17 7 15 7 14 11 16 16 17 17 17 15 15 17 12 5 14 7

output:

11

result:

ok single line: '11'

Test #54:

score: 0
Time Limit Exceeded

input:

18
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
26
1 1 11 15 12 16 15 5 12 12 10 10 5 3 12 11 8 15 12 8 7 10 3 4 15 15

output:


result:


Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #4:

0%

Subtask #6:

score: 0
Skipped

Dependency #5:

0%

Subtask #7:

score: 0
Skipped

Dependency #6:

0%

Subtask #8:

score: 0
Skipped

Dependency #1:

0%