QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#667030 | #7159. Candy | blackslex# | 6 | 0ms | 3960kb | C++14 | 540b | 2024-10-22 20:48:32 | 2024-10-22 20:48:43 |
answer
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<ll, int>;
const int N = 105;
int n, f, t;
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());
ll csum = 0;
for (int i = 0; i < f; i++) csum += ca[i];
if (csum < t) printf("NO"), exit(0);
if (f == 1 && a[0] >= t) printf("0");
else if (f == 2 && a[0] + a[1] >= t) printf("0");
else printf("1");
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 6
Accepted
Test #1:
score: 6
Accepted
time: 0ms
memory: 3672kb
input:
1 1 7 7
output:
0
result:
ok single line: '0'
Test #2:
score: 6
Accepted
time: 0ms
memory: 3728kb
input:
1 1 8 7
output:
NO
result:
ok single line: 'NO'
Test #3:
score: 6
Accepted
time: 0ms
memory: 3960kb
input:
2 1 7 5 6
output:
NO
result:
ok single line: 'NO'
Test #4:
score: 6
Accepted
time: 0ms
memory: 3960kb
input:
2 1 7 7 9
output:
0
result:
ok single line: '0'
Test #5:
score: 6
Accepted
time: 0ms
memory: 3696kb
input:
2 1 7 5 7
output:
1
result:
ok single line: '1'
Test #6:
score: 6
Accepted
time: 0ms
memory: 3960kb
input:
2 2 7 2 4
output:
NO
result:
ok single line: 'NO'
Test #7:
score: 6
Accepted
time: 0ms
memory: 3904kb
input:
2 2 7 3 4
output:
0
result:
ok single line: '0'
Test #8:
score: 6
Accepted
time: 0ms
memory: 3684kb
input:
1 1 100 100
output:
0
result:
ok single line: '0'
Subtask #2:
score: 0
Wrong Answer
Test #9:
score: 0
Wrong Answer
time: 0ms
memory: 3668kb
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:
1
result:
wrong answer 1st lines differ - expected: '1805', found: '1'
Subtask #3:
score: 0
Wrong Answer
Dependency #1:
100%
Accepted
Test #24:
score: 16
Accepted
time: 0ms
memory: 3748kb
input:
1 1 7 7
output:
0
result:
ok single line: '0'
Test #25:
score: 16
Accepted
time: 0ms
memory: 3936kb
input:
1 1 8 7
output:
NO
result:
ok single line: 'NO'
Test #26:
score: 16
Accepted
time: 0ms
memory: 3672kb
input:
2 1 7 5 6
output:
NO
result:
ok single line: 'NO'
Test #27:
score: 16
Accepted
time: 0ms
memory: 3868kb
input:
2 1 7 7 9
output:
0
result:
ok single line: '0'
Test #28:
score: 16
Accepted
time: 0ms
memory: 3960kb
input:
2 1 7 5 7
output:
1
result:
ok single line: '1'
Test #29:
score: 16
Accepted
time: 0ms
memory: 3676kb
input:
2 2 7 2 4
output:
NO
result:
ok single line: 'NO'
Test #30:
score: 16
Accepted
time: 0ms
memory: 3724kb
input:
2 2 7 3 4
output:
0
result:
ok single line: '0'
Test #31:
score: 16
Accepted
time: 0ms
memory: 3660kb
input:
3 1 7 4 5 6
output:
NO
result:
ok single line: 'NO'
Test #32:
score: 0
Wrong Answer
time: 0ms
memory: 3960kb
input:
3 1 7 4 5 7
output:
1
result:
wrong answer 1st lines differ - expected: '2', found: '1'
Subtask #4:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%
Subtask #5:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%