QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#667417 | #7159. Candy | Warinchai_s# | 22 | 31ms | 3824kb | C++14 | 783b | 2024-10-22 22:52:12 | 2024-10-22 22:52:18 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
int ar[105];
int dp[105][105];
vector<pair<int,int>>v;
map<int,int>mp[105];
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n,f,t;cin>>n>>f>>t;
for(int i=0;i<n;i++){
cin>>ar[i];
}
int ans=LLONG_MAX;
for(int i=0;i<(1<<n);i++){
int x=__builtin_popcount(i);
if(x!=f)continue;
vector<int>v;
int sum=0;
for(int j=0;j<n;j++){
if((i>>j)&1)v.push_back(j),sum+=ar[j];
}
if(sum<t)continue;
int tans=0;
for(int j=0;j<f;j++){
tans+=v[j]-j;
}
ans=min(ans,tans);
}
if(ans==LLONG_MAX)cout<<"NO\n";
else cout<<ans<<"\n";
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 6
Accepted
Test #1:
score: 6
Accepted
time: 1ms
memory: 3596kb
input:
1 1 7 7
output:
0
result:
ok single line: '0'
Test #2:
score: 6
Accepted
time: 1ms
memory: 3624kb
input:
1 1 8 7
output:
NO
result:
ok single line: 'NO'
Test #3:
score: 6
Accepted
time: 0ms
memory: 3492kb
input:
2 1 7 5 6
output:
NO
result:
ok single line: 'NO'
Test #4:
score: 6
Accepted
time: 1ms
memory: 3596kb
input:
2 1 7 7 9
output:
0
result:
ok single line: '0'
Test #5:
score: 6
Accepted
time: 0ms
memory: 3524kb
input:
2 1 7 5 7
output:
1
result:
ok single line: '1'
Test #6:
score: 6
Accepted
time: 0ms
memory: 3540kb
input:
2 2 7 2 4
output:
NO
result:
ok single line: 'NO'
Test #7:
score: 6
Accepted
time: 1ms
memory: 3588kb
input:
2 2 7 3 4
output:
0
result:
ok single line: '0'
Test #8:
score: 6
Accepted
time: 1ms
memory: 3624kb
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: 1ms
memory: 3532kb
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:
NO
result:
wrong answer 1st lines differ - expected: '1805', found: 'NO'
Subtask #3:
score: 16
Accepted
Dependency #1:
100%
Accepted
Test #24:
score: 16
Accepted
time: 1ms
memory: 3532kb
input:
1 1 7 7
output:
0
result:
ok single line: '0'
Test #25:
score: 16
Accepted
time: 0ms
memory: 3772kb
input:
1 1 8 7
output:
NO
result:
ok single line: 'NO'
Test #26:
score: 16
Accepted
time: 0ms
memory: 3528kb
input:
2 1 7 5 6
output:
NO
result:
ok single line: 'NO'
Test #27:
score: 16
Accepted
time: 0ms
memory: 3540kb
input:
2 1 7 7 9
output:
0
result:
ok single line: '0'
Test #28:
score: 16
Accepted
time: 1ms
memory: 3752kb
input:
2 1 7 5 7
output:
1
result:
ok single line: '1'
Test #29:
score: 16
Accepted
time: 1ms
memory: 3492kb
input:
2 2 7 2 4
output:
NO
result:
ok single line: 'NO'
Test #30:
score: 16
Accepted
time: 1ms
memory: 3588kb
input:
2 2 7 3 4
output:
0
result:
ok single line: '0'
Test #31:
score: 16
Accepted
time: 0ms
memory: 3492kb
input:
3 1 7 4 5 6
output:
NO
result:
ok single line: 'NO'
Test #32:
score: 16
Accepted
time: 0ms
memory: 3524kb
input:
3 1 7 4 5 7
output:
2
result:
ok single line: '2'
Test #33:
score: 16
Accepted
time: 1ms
memory: 3568kb
input:
3 1 7 4 8 7
output:
1
result:
ok single line: '1'
Test #34:
score: 16
Accepted
time: 1ms
memory: 3528kb
input:
3 1 7 7 3 9
output:
0
result:
ok single line: '0'
Test #35:
score: 16
Accepted
time: 1ms
memory: 3596kb
input:
3 2 7 3 3 3
output:
NO
result:
ok single line: 'NO'
Test #36:
score: 16
Accepted
time: 1ms
memory: 3624kb
input:
3 2 7 2 3 4
output:
2
result:
ok single line: '2'
Test #37:
score: 16
Accepted
time: 1ms
memory: 3804kb
input:
3 2 7 3 2 4
output:
1
result:
ok single line: '1'
Test #38:
score: 16
Accepted
time: 1ms
memory: 3548kb
input:
3 2 7 4 5 6
output:
0
result:
ok single line: '0'
Test #39:
score: 16
Accepted
time: 0ms
memory: 3528kb
input:
3 3 7 1 3 2
output:
NO
result:
ok single line: 'NO'
Test #40:
score: 16
Accepted
time: 0ms
memory: 3588kb
input:
3 3 7 3 1 3
output:
0
result:
ok single line: '0'
Test #41:
score: 16
Accepted
time: 1ms
memory: 3596kb
input:
3 2 0 0 0 0
output:
0
result:
ok single line: '0'
Test #42:
score: 16
Accepted
time: 0ms
memory: 3524kb
input:
3 2 0 1 2 3
output:
0
result:
ok single line: '0'
Test #43:
score: 16
Accepted
time: 30ms
memory: 3560kb
input:
20 10 6566144533 323906753 73234 169258261 146483217 2526483 50563297 7173957 419870302 86885946 277634715 748939350 422834669 440114820 504900304 648304476 630339210 900877811 593594945 953548400 722690548
output:
100
result:
ok single line: '100'
Test #44:
score: 16
Accepted
time: 26ms
memory: 3476kb
input:
20 10 6164244072 155183169 228236990 208003086 343519393 203430078 129307145 158643368 33100189 235687056 222657550 413967161 896436020 887689465 550380926 691043319 946504501 444961305 475841383 388568669 468851323
output:
100
result:
ok single line: '100'
Test #45:
score: 16
Accepted
time: 3ms
memory: 3528kb
input:
20 18 9610913809 58382570 1322710 654840381 202842775 300914313 462981306 141101410 670033653 737028856 888310178 420221248 393987230 214258398 897791395 261977352 762131762 938005468 558347054 363867624 742273406
output:
36
result:
ok single line: '36'
Test #46:
score: 16
Accepted
time: 19ms
memory: 3596kb
input:
20 8 8000000000 1000000000 999999999 1000000000 1000000000 999999999 999999999 999999999 1000000000 1000000000 999999999 1000000000 1000000000 999999999 999999999 999999999 1000000000 999999999 1000000000 999999999 1000000000
output:
28
result:
ok single line: '28'
Test #47:
score: 16
Accepted
time: 21ms
memory: 3600kb
input:
20 12 12000000000 1000000000 1000000000 999999999 999999999 1000000000 999999999 1000000000 999999999 999999999 1000000000 1000000000 999999999 1000000000 999999999 999999999 1000000000 1000000000 1000000000 1000000000 1000000000
output:
61
result:
ok single line: '61'
Test #48:
score: 16
Accepted
time: 21ms
memory: 3584kb
input:
20 12 12000000000 999999999 999999999 999999999 999999999 1000000000 999999999 1000000000 999999999 1000000000 1000000000 1000000000 1000000000 1000000000 999999999 1000000000 999999999 1000000000 1000000000 1000000000 999999999
output:
NO
result:
ok single line: 'NO'
Test #49:
score: 16
Accepted
time: 31ms
memory: 3564kb
input:
20 10 3333333333 263624178 602898190 420963433 437884997 29710349 491478505 762760712 223384385 55154427 247361461 311280665 796832434 325014303 418646560 443155385 309305851 287458918 290458843 73509473 381919309
output:
0
result:
ok single line: '0'
Test #50:
score: 16
Accepted
time: 30ms
memory: 3532kb
input:
20 10 6800000000 6727977 168476741 640453099 745909210 465912066 597929442 309004415 752756925 512558999 407756549 699491803 550336604 928590530 509682749 930053726 972170609 830489125 317341090 602598601 786818691
output:
28
result:
ok single line: '28'
Test #51:
score: 16
Accepted
time: 30ms
memory: 3824kb
input:
20 10 8400000000 490759429 577739494 777938828 26684416 983875443 660699290 311443997 945777950 948498829 437718566 114473495 420625153 506020763 85582893 767427548 976050679 783422475 168447458 633031695 182488951
output:
NO
result:
ok single line: 'NO'
Test #52:
score: 16
Accepted
time: 30ms
memory: 3528kb
input:
20 10 3000000000 132894078 60976811 122272635 118825862 344797520 499759987 416983334 464948474 332856593 716815545 587427340 521430452 580842697 777336152 740614865 773332159 910211548 760580366 872763270 862088305
output:
0
result:
ok single line: '0'
Test #53:
score: 16
Accepted
time: 30ms
memory: 3528kb
input:
20 10 4000000000 201987269 198126981 158756144 188296059 182086700 262863090 543395895 372218384 432780571 419887028 510659429 556696166 384624599 668282669 672913794 605220743 692335425 477735221 622621736 842880145
output:
21
result:
ok single line: '21'
Test #54:
score: 16
Accepted
time: 30ms
memory: 3524kb
input:
20 10 5000000000 144425144 110530990 359934042 0 400143548 443138967 331050017 638875702 268160577 558102915 551357335 724461476 658896595 662039701 706213909 756666187 789234319 631704115 935768714 876353223
output:
26
result:
ok single line: '26'
Test #55:
score: 16
Accepted
time: 30ms
memory: 3752kb
input:
20 10 6000000000 240858929 20956451 271016582 198575969 414187671 287687480 267328642 166255826 612041111 742856091 544779310 462660138 721565200 712987358 613477373 861977305 772887187 754803381 751790051 806510817
output:
51
result:
ok single line: '51'
Test #56:
score: 16
Accepted
time: 29ms
memory: 3508kb
input:
20 10 7000000000 72400301 253293083 88322729 203869372 305687730 15909565 444043421 507401475 548666163 495533730 479026621 615617352 677540315 756907917 753695398 609838578 887405794 651243868 791919978 907717036
output:
88
result:
ok single line: '88'
Test #57:
score: 16
Accepted
time: 30ms
memory: 3532kb
input:
20 10 8000000000 239757482 257154616 26372785 260661934 255928849 390775920 305428517 432319097 334310334 398076038 518978541 494543443 527856458 736609886 858915291 753585415 832823371 804815588 905429868 846897833
output:
NO
result:
ok single line: 'NO'
Test #58:
score: 16
Accepted
time: 0ms
memory: 3532kb
input:
20 18 9400000000 233234959 239533200 196553166 246868328 201443657 349435478 348192133 296370133 507063613 437055050 375561412 669201134 621129480 598775583 518467201 737587081 757134181 924422699 821116542 1000000000
output:
20
result:
ok single line: '20'
Test #59:
score: 16
Accepted
time: 3ms
memory: 3532kb
input:
20 18 18000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 999999999 1000000000 1000000000 1000000000 999999999 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000 1000000000
output:
21
result:
ok single line: '21'
Test #60:
score: 16
Accepted
time: 0ms
memory: 3592kb
input:
5 5 123123123 1000000000 1000000000 0 0 0
output:
0
result:
ok single line: '0'
Test #61:
score: 16
Accepted
time: 1ms
memory: 3804kb
input:
6 2 27 10 4 20 6 3 3
output:
1
result:
ok single line: '1'
Test #62:
score: 16
Accepted
time: 0ms
memory: 3756kb
input:
6 5 5000000000 1000000000 1000000000 0 1000000000 1000000000 1000000000
output:
3
result:
ok single line: '3'
Test #63:
score: 16
Accepted
time: 1ms
memory: 3800kb
input:
3 2 100 20 30 60
output:
NO
result:
ok single line: 'NO'
Test #64:
score: 16
Accepted
time: 0ms
memory: 3820kb
input:
1 1 100 100
output:
0
result:
ok single line: '0'
Subtask #4:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%
Subtask #5:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%