QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#667135#7159. Candyblackslex#0 0ms4056kbC++14747b2024-10-22 21:11:422024-10-22 21:12:01

Judging History

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

  • [2024-10-22 21:12:01]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:4056kb
  • [2024-10-22 21:11:42]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;

const int N = 105;
int n, f, t;
set<int> s;

int main() {
    scanf("%d %d %d", &n, &f, &t);
    vector<int> a(n);
    for (auto &e: a) scanf("%d", &e);
    vector<int> ca = a;
    sort(ca.rbegin(), ca.rend());
    int csum = 0;
    for (int i = 0; i < f; i++) csum += ca[i];
    if (csum < t) printf("NO"), exit(0);
    for (int i = f; i < n; i++) if (a[i]) s.emplace(i);
    int cur = 0, ans = 0;
    for (int i = 0; i < f; i++) cur += a[i];
    for (int i = f - 1; i >= 0; i--) {
        if (!a[i]) {
            cur += (a[i] = 1);
            ans += *s.begin() - i;
            s.erase(s.begin());
        }
        if (cur >= t) break;
    }
    printf("%d", ans);
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

input:

1 1 7
7

output:

0

result:

ok single line: '0'

Test #2:

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

input:

1 1 8
7

output:

NO

result:

ok single line: 'NO'

Test #3:

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

input:

2 1 7
5 6

output:

NO

result:

ok single line: 'NO'

Test #4:

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

input:

2 1 7
7 9

output:

0

result:

ok single line: '0'

Test #5:

score: 0
Wrong Answer
time: 0ms
memory: 3848kb

input:

2 1 7
5 7

output:

0

result:

wrong answer 1st lines differ - expected: '1', found: '0'

Subtask #2:

score: 0
Time Limit Exceeded

Test #9:

score: 19
Accepted
time: 0ms
memory: 3860kb

input:

100 50 50
1 0 1 0 0 0 0 0 0 0 0 1 0 0 0 1 1 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 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:

1805

result:

ok single line: '1805'

Test #10:

score: 19
Accepted
time: 0ms
memory: 4052kb

input:

100 40 40
1 0 1 0 1 0 0 0 1 1 1 1 0 1 1 0 0 1 1 1 1 1 0 1 1 0 1 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 0 1 0 1 1 1 1 1 1 0 0 0 0 1 1 1 1 0 1 1 1 0 0 0 0 1 0 0 1 0 1 1 0 0 0 1 1 0 0 1 0 1 0 1 0 0 0 0 0 0 0 1 0 0 1 1 1 0

output:

607

result:

ok single line: '607'

Test #11:

score: 19
Accepted
time: 0ms
memory: 4056kb

input:

100 60 60
0 0 1 0 0 0 1 1 0 1 1 0 1 1 0 0 0 1 1 1 1 1 1 1 0 1 0 1 1 1 0 1 0 1 0 0 1 1 0 1 0 1 0 1 0 1 1 1 1 0 0 1 1 1 0 1 1 0 0 1 1 1 1 0 1 1 1 0 1 0 0 1 1 1 1 0 1 0 1 1 1 0 1 1 1 1 1 0 1 1 1 1 1 1 0 0 0 0 1 0

output:

1229

result:

ok single line: '1229'

Test #12:

score: 19
Accepted
time: 0ms
memory: 3656kb

input:

100 60 60
0 0 0 1 1 1 1 1 0 0 0 0 1 0 0 1 0 1 0 1 1 0 0 1 1 1 1 0 1 0 1 1 0 1 1 0 1 1 1 1 1 0 1 0 1 0 0 1 1 0 0 0 1 0 0 1 1 1 1 1 1 1 0 1 0 1 1 0 1 1 0 0 0 1 1 0 1 1 1 0 0 0 1 1 1 0 0 1 0 1 0 0 1 0 0 1 1 0 0 1

output:

NO

result:

ok single line: 'NO'

Test #13:

score: 19
Accepted
time: 0ms
memory: 3772kb

input:

100 98 47
0 0 0 0 0 1 1 1 0 1 1 0 0 1 0 1 0 1 0 0 0 0 0 0 1 1 0 0 0 1 1 0 0 0 1 1 0 1 0 0 0 0 0 0 1 1 1 0 1 0 0 0 0 1 0 1 0 0 0 0 1 1 1 1 1 1 1 1 0 0 1 1 0 1 0 1 1 1 1 1 0 0 1 1 1 0 1 1 0 0 0 1 0 1 0 1 1 1 0 0

output:

0

result:

ok single line: '0'

Test #14:

score: 19
Accepted
time: 0ms
memory: 4048kb

input:

100 50 33
0 1 0 0 1 1 0 1 1 0 0 1 1 0 1 0 0 1 0 0 1 1 1 0 0 1 1 0 1 1 1 0 1 0 0 1 0 1 0 1 1 0 0 1 0 1 1 1 1 0 0 1 1 1 0 0 0 1 0 0 1 1 1 0 0 0 1 1 1 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 1 1 0 0 0 0 1 1 1

output:

84

result:

ok single line: '84'

Test #15:

score: 19
Accepted
time: 0ms
memory: 4052kb

input:

100 50 40
0 0 1 1 0 0 1 0 0 1 0 0 0 1 1 1 0 1 0 0 1 1 1 0 0 0 1 0 1 0 0 0 0 1 0 1 0 0 1 0 0 0 0 1 1 0 0 0 1 0 1 0 1 0 0 1 1 0 0 0 1 1 0 0 1 1 0 1 1 1 0 0 1 1 1 1 1 0 1 1 1 0 1 1 1 0 0 0 1 0 1 0 0 1 1 0 0 0 1 1

output:

725

result:

ok single line: '725'

Test #16:

score: 19
Accepted
time: 0ms
memory: 3708kb

input:

100 50 60
1 0 0 0 0 1 1 0 1 1 1 0 1 0 0 1 1 0 0 0 1 1 0 1 1 1 1 1 0 0 1 1 0 1 0 0 1 1 1 1 1 1 1 0 0 1 0 0 0 0 1 0 1 1 1 1 1 1 1 1 0 0 1 0 0 1 0 1 0 1 1 1 0 1 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 1 0 1 0 1 0 0 1 0 1

output:

NO

result:

ok single line: 'NO'

Test #17:

score: 19
Accepted
time: 0ms
memory: 3848kb

input:

100 90 90
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 0 1 0 1 1 1 1 1 1 1

output:

365

result:

ok single line: '365'

Test #18:

score: 0
Time Limit Exceeded

input:

100 60 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0

output:


result:


Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

0%