2082 | 2022-12-16 19:58:34 | eokor | Rendőrségi Üldözés 4 | cpp11 | Wrong answer 10/100 | 2.599s | 4620 KiB |
#include <iostream>
//#include <fstream>
using namespace std;
int n,hossz,t,osszegv=0,mini=1000;
long int lampa[10000];
void backtrack(int i, int alltam, int seg, int mehet){
if(i<=n)
{
if((lampa[i]+alltam)/t%2==0)//zold
{
backtrack(i+1,alltam,seg,mehet);
}
else{
if(mehet>0)//athajthatok
{
backtrack(i+1,alltam,seg,mehet-1);
}
seg=t-lampa[i]%t;
backtrack(i+1,alltam+seg,seg,mehet);
}
}
else
{
if(alltam<mini)
{
mini=alltam;
}
}
}
int main()
{
// ifstream cin("be1.txt");
int seg=0,alltam=0,mehet;
cin>>n>>mehet>>t>>hossz;
osszegv=hossz;
lampa[0]=0;
for(int i=1;i<=n;i++)
{
cin>>lampa[i];
}
backtrack(1,0,0,mehet);
cout<<osszegv+mini;
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1756 KiB | ||||
2 | Accepted | 2ms | 1920 KiB | ||||
subtask2 | 10/10 | ||||||
3 | Accepted | 2ms | 2124 KiB | ||||
4 | Accepted | 2ms | 2636 KiB | ||||
5 | Accepted | 2ms | 2580 KiB | ||||
6 | Accepted | 2ms | 2556 KiB | ||||
7 | Accepted | 2ms | 2684 KiB | ||||
subtask3 | 0/15 | ||||||
8 | Wrong answer | 2ms | 2788 KiB | ||||
9 | Accepted | 2ms | 2764 KiB | ||||
10 | Wrong answer | 2ms | 3036 KiB | ||||
11 | Wrong answer | 2ms | 3176 KiB | ||||
subtask4 | 0/15 | ||||||
12 | Accepted | 2ms | 3176 KiB | ||||
13 | Wrong answer | 2ms | 3416 KiB | ||||
14 | Accepted | 3ms | 3556 KiB | ||||
15 | Wrong answer | 2ms | 3912 KiB | ||||
subtask5 | 0/25 | ||||||
16 | Time limit exceeded | 2.599s | 4100 KiB | ||||
17 | Time limit exceeded | 2.581s | 3280 KiB | ||||
18 | Time limit exceeded | 2.542s | 4124 KiB | ||||
19 | Time limit exceeded | 2.569s | 4168 KiB | ||||
20 | Time limit exceeded | 2.572s | 4032 KiB | ||||
subtask6 | 0/15 | ||||||
21 | Time limit exceeded | 2.545s | 3208 KiB | ||||
22 | Time limit exceeded | 2.565s | 4152 KiB | ||||
23 | Time limit exceeded | 2.565s | 3268 KiB | ||||
24 | Time limit exceeded | 2.565s | 3272 KiB | ||||
25 | Time limit exceeded | 2.585s | 4244 KiB | ||||
subtask7 | 0/20 | ||||||
26 | Runtime error | 7ms | 4320 KiB | ||||
27 | Runtime error | 7ms | 4320 KiB | ||||
28 | Runtime error | 7ms | 4500 KiB | ||||
29 | Runtime error | 7ms | 4488 KiB | ||||
30 | Runtime error | 7ms | 4620 KiB |