QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#765555#8268. TychoPioneer#32 84ms90472kbC++201.6kb2024-11-20 14:38:282024-11-20 14:38:32

Judging History

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

  • [2024-11-20 14:38:32]
  • 评测
  • 测评结果:32
  • 用时:84ms
  • 内存:90472kb
  • [2024-11-20 14:38:28]
  • 提交

answer

#include <bits/stdc++.h>
 
#define ll long long
#define lb lower_bound
#define pii pair<int,int>
#define pll pair<ll,ll>
#define F first
#define S second
#define ld long double
#define pb push_back
#define all(v) v.begin(),v.end()
#define in insert
#define sz(s) (int)s.size()
#define ppb pop_back
#define mem(a,i) memset(a,i,sizeof(a))
#define int ll

using namespace std;
 
const int MAX=1e5+10;
const int inf=2e18;
const int mod=1e9+7;

const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

int b,p,d,n;
int dp[MAX][110],a[MAX];

void solve(){
    cin>>b>>p>>d>>n;
    for(int i=1;i<=n;i++)cin>>a[i];
    a[0]=0;
    for(int i=0;i<=n;i++)for(int j=0;j<p;j++)dp[i][j]=inf;
    dp[0][0]=0;
    for(int i=0;i<=n;i++){
        for(int j=1;j<p;j++)dp[i][0]=min(dp[i][0],dp[i][j]+(p-j));
        for(int j=0;j<p;j++){
            int nxt=(j+(a[i+1]-a[i]))%p;
            int dist=a[i+1]-a[i]-1;
            int cnt=0;
            if(p-j<=dist){
                dist-=p-j;
                cnt++;
            }
            cnt+=dist/p;
            dp[i+1][nxt]=min(dp[i+1][nxt],dp[i][j]+cnt*d);
        }
    }
    int ans=inf;
    for(int i=0;i<=n;i++){
        int dist=b-a[i];
        ans=min(ans,dp[i][0]+((dist-1)/p)*d);
    }
    cout<<ans+b<<"\n";
}

signed main(){
    // freopen("escape.in","r",stdin);
    // freopen("escape.out","w",stdout);
    ios_base::sync_with_stdio(0);
    // cin.tie(0);
    // cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--)solve();
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 8
Accepted
time: 1ms
memory: 3676kb

input:

1000000000000 1 1000000 0

output:

1000000999999000000

result:

ok single line: '1000000999999000000'

Test #2:

score: 8
Accepted
time: 0ms
memory: 3616kb

input:

100 10 11 10
10
11
20
30
38
49
50
60
70
90

output:

122

result:

ok single line: '122'

Test #3:

score: 8
Accepted
time: 1ms
memory: 5736kb

input:

100 10 11 15
1
5
9
15
24
25
39
40
45
66
75
79
85
95
97

output:

138

result:

ok single line: '138'

Test #4:

score: 0
Wrong Answer
time: 4ms
memory: 5852kb

input:

100000 1000 123 1000
20
25
139
161
312
336
379
472
780
803
1000
1117
1132
1159
1411
1429
1430
1623
1964
2000
2266
2284
2537
2717
2963
3000
3153
3217
3400
3462
3477
3525
3542
3711
3754
3946
3958
4000
4091
4102
4131
4458
4649
4661
4804
4883
4898
4913
4979
5000
5210
5243
5357
5383
5393
5441
5627
5969
6...

output:

87823

result:

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

Subtask #2:

score: 5
Accepted

Test #11:

score: 5
Accepted
time: 1ms
memory: 3680kb

input:

108 100 10000 5
10
20
30
40
98

output:

110

result:

ok single line: '110'

Test #12:

score: 5
Accepted
time: 0ms
memory: 3620kb

input:

118 100 10000 5
10
20
30
98
108

output:

120

result:

ok single line: '120'

Test #13:

score: 5
Accepted
time: 1ms
memory: 5700kb

input:

206 100 10000 5
10
20
30
98
196

output:

210

result:

ok single line: '210'

Test #14:

score: 5
Accepted
time: 0ms
memory: 3716kb

input:

128 100 10000 5
10
20
98
108
118

output:

130

result:

ok single line: '130'

Test #15:

score: 5
Accepted
time: 0ms
memory: 3616kb

input:

206 100 10000 5
10
20
98
108
196

output:

210

result:

ok single line: '210'

Test #16:

score: 5
Accepted
time: 0ms
memory: 3652kb

input:

216 100 10000 5
10
20
98
196
206

output:

220

result:

ok single line: '220'

Test #17:

score: 5
Accepted
time: 0ms
memory: 3672kb

input:

304 100 10000 5
10
20
98
196
294

output:

310

result:

ok single line: '310'

Test #18:

score: 5
Accepted
time: 1ms
memory: 5656kb

input:

138 100 10000 5
10
98
108
118
128

output:

140

result:

ok single line: '140'

Test #19:

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

input:

206 100 10000 5
10
98
108
118
196

output:

210

result:

ok single line: '210'

Test #20:

score: 5
Accepted
time: 1ms
memory: 5796kb

input:

216 100 10000 5
10
98
108
196
206

output:

220

result:

ok single line: '220'

Test #21:

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

input:

304 100 10000 5
10
98
108
196
294

output:

310

result:

ok single line: '310'

Test #22:

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

input:

226 100 10000 5
10
98
196
206
216

output:

230

result:

ok single line: '230'

Test #23:

score: 5
Accepted
time: 0ms
memory: 3732kb

input:

304 100 10000 5
10
98
196
206
294

output:

310

result:

ok single line: '310'

Test #24:

score: 5
Accepted
time: 0ms
memory: 3616kb

input:

314 100 10000 5
10
98
196
294
304

output:

320

result:

ok single line: '320'

Test #25:

score: 5
Accepted
time: 0ms
memory: 3636kb

input:

402 100 10000 5
10
98
196
294
392

output:

410

result:

ok single line: '410'

Test #26:

score: 5
Accepted
time: 0ms
memory: 5720kb

input:

148 100 10000 5
98
108
118
128
138

output:

150

result:

ok single line: '150'

Test #27:

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

input:

206 100 10000 5
98
108
118
128
196

output:

210

result:

ok single line: '210'

Test #28:

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

input:

216 100 10000 5
98
108
118
196
206

output:

220

result:

ok single line: '220'

Test #29:

score: 5
Accepted
time: 1ms
memory: 5716kb

input:

304 100 10000 5
98
108
118
196
294

output:

310

result:

ok single line: '310'

Test #30:

score: 5
Accepted
time: 0ms
memory: 5660kb

input:

226 100 10000 5
98
108
196
206
216

output:

230

result:

ok single line: '230'

Test #31:

score: 5
Accepted
time: 0ms
memory: 5780kb

input:

304 100 10000 5
98
108
196
206
294

output:

310

result:

ok single line: '310'

Test #32:

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

input:

314 100 10000 5
98
108
196
294
304

output:

320

result:

ok single line: '320'

Test #33:

score: 5
Accepted
time: 1ms
memory: 5648kb

input:

402 100 10000 5
98
108
196
294
392

output:

410

result:

ok single line: '410'

Test #34:

score: 5
Accepted
time: 0ms
memory: 3676kb

input:

236 100 10000 5
98
196
206
216
226

output:

240

result:

ok single line: '240'

Test #35:

score: 5
Accepted
time: 0ms
memory: 3760kb

input:

304 100 10000 5
98
196
206
216
294

output:

310

result:

ok single line: '310'

Test #36:

score: 5
Accepted
time: 0ms
memory: 3756kb

input:

314 100 10000 5
98
196
206
294
304

output:

320

result:

ok single line: '320'

Test #37:

score: 5
Accepted
time: 0ms
memory: 3700kb

input:

402 100 10000 5
98
196
206
294
392

output:

410

result:

ok single line: '410'

Test #38:

score: 5
Accepted
time: 1ms
memory: 3768kb

input:

324 100 10000 5
98
196
294
304
314

output:

330

result:

ok single line: '330'

Test #39:

score: 5
Accepted
time: 0ms
memory: 5716kb

input:

402 100 10000 5
98
196
294
304
392

output:

410

result:

ok single line: '410'

Test #40:

score: 5
Accepted
time: 0ms
memory: 3756kb

input:

412 100 10000 5
98
196
294
392
402

output:

420

result:

ok single line: '420'

Test #41:

score: 5
Accepted
time: 0ms
memory: 3732kb

input:

500 100 10000 5
98
196
294
392
490

output:

510

result:

ok single line: '510'

Test #42:

score: 5
Accepted
time: 0ms
memory: 3680kb

input:

10 2 10 2
1
3

output:

41

result:

ok single line: '41'

Test #43:

score: 5
Accepted
time: 0ms
memory: 3732kb

input:

100 21 10 2
5
54

output:

140

result:

ok single line: '140'

Test #44:

score: 5
Accepted
time: 0ms
memory: 3732kb

input:

100 21 10 9
18
21
53
62
85
86
88
90
91

output:

121

result:

ok single line: '121'

Test #45:

score: 5
Accepted
time: 0ms
memory: 3748kb

input:

100 21 10 10
30
39
40
43
45
49
52
57
70
72

output:

132

result:

ok single line: '132'

Test #46:

score: 5
Accepted
time: 0ms
memory: 3748kb

input:

156 20 1 10
19
37
54
70
85
99
112
124
135
145

output:

162

result:

ok single line: '162'

Test #47:

score: 5
Accepted
time: 1ms
memory: 5768kb

input:

156 20 20 10
19
37
54
70
85
99
112
124
135
145

output:

211

result:

ok single line: '211'

Test #48:

score: 5
Accepted
time: 1ms
memory: 5852kb

input:

156 20 30 10
19
37
54
70
85
99
112
124
135
145

output:

211

result:

ok single line: '211'

Test #49:

score: 5
Accepted
time: 1ms
memory: 5720kb

input:

18 4 5 2
8
15

output:

29

result:

ok single line: '29'

Test #50:

score: 5
Accepted
time: 1ms
memory: 5788kb

input:

18 4 0 2
8
15

output:

18

result:

ok single line: '18'

Test #51:

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

input:

18 10 100 2
8
15

output:

20

result:

ok single line: '20'

Test #52:

score: 5
Accepted
time: 0ms
memory: 3616kb

input:

18 4 100 0

output:

418

result:

ok single line: '418'

Test #53:

score: 5
Accepted
time: 1ms
memory: 5724kb

input:

65 20 100 3
14
25
33

output:

172

result:

ok single line: '172'

Subtask #3:

score: 7
Accepted

Dependency #2:

100%
Accepted

Test #54:

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

input:

108 100 10000 5
10
20
30
40
98

output:

110

result:

ok single line: '110'

Test #55:

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

input:

118 100 10000 5
10
20
30
98
108

output:

120

result:

ok single line: '120'

Test #56:

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

input:

206 100 10000 5
10
20
30
98
196

output:

210

result:

ok single line: '210'

Test #57:

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

input:

128 100 10000 5
10
20
98
108
118

output:

130

result:

ok single line: '130'

Test #58:

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

input:

206 100 10000 5
10
20
98
108
196

output:

210

result:

ok single line: '210'

Test #59:

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

input:

216 100 10000 5
10
20
98
196
206

output:

220

result:

ok single line: '220'

Test #60:

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

input:

304 100 10000 5
10
20
98
196
294

output:

310

result:

ok single line: '310'

Test #61:

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

input:

138 100 10000 5
10
98
108
118
128

output:

140

result:

ok single line: '140'

Test #62:

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

input:

206 100 10000 5
10
98
108
118
196

output:

210

result:

ok single line: '210'

Test #63:

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

input:

216 100 10000 5
10
98
108
196
206

output:

220

result:

ok single line: '220'

Test #64:

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

input:

304 100 10000 5
10
98
108
196
294

output:

310

result:

ok single line: '310'

Test #65:

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

input:

226 100 10000 5
10
98
196
206
216

output:

230

result:

ok single line: '230'

Test #66:

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

input:

304 100 10000 5
10
98
196
206
294

output:

310

result:

ok single line: '310'

Test #67:

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

input:

314 100 10000 5
10
98
196
294
304

output:

320

result:

ok single line: '320'

Test #68:

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

input:

402 100 10000 5
10
98
196
294
392

output:

410

result:

ok single line: '410'

Test #69:

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

input:

148 100 10000 5
98
108
118
128
138

output:

150

result:

ok single line: '150'

Test #70:

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

input:

206 100 10000 5
98
108
118
128
196

output:

210

result:

ok single line: '210'

Test #71:

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

input:

216 100 10000 5
98
108
118
196
206

output:

220

result:

ok single line: '220'

Test #72:

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

input:

304 100 10000 5
98
108
118
196
294

output:

310

result:

ok single line: '310'

Test #73:

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

input:

226 100 10000 5
98
108
196
206
216

output:

230

result:

ok single line: '230'

Test #74:

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

input:

304 100 10000 5
98
108
196
206
294

output:

310

result:

ok single line: '310'

Test #75:

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

input:

314 100 10000 5
98
108
196
294
304

output:

320

result:

ok single line: '320'

Test #76:

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

input:

402 100 10000 5
98
108
196
294
392

output:

410

result:

ok single line: '410'

Test #77:

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

input:

236 100 10000 5
98
196
206
216
226

output:

240

result:

ok single line: '240'

Test #78:

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

input:

304 100 10000 5
98
196
206
216
294

output:

310

result:

ok single line: '310'

Test #79:

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

input:

314 100 10000 5
98
196
206
294
304

output:

320

result:

ok single line: '320'

Test #80:

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

input:

402 100 10000 5
98
196
206
294
392

output:

410

result:

ok single line: '410'

Test #81:

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

input:

324 100 10000 5
98
196
294
304
314

output:

330

result:

ok single line: '330'

Test #82:

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

input:

402 100 10000 5
98
196
294
304
392

output:

410

result:

ok single line: '410'

Test #83:

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

input:

412 100 10000 5
98
196
294
392
402

output:

420

result:

ok single line: '420'

Test #84:

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

input:

500 100 10000 5
98
196
294
392
490

output:

510

result:

ok single line: '510'

Test #85:

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

input:

10 2 10 2
1
3

output:

41

result:

ok single line: '41'

Test #86:

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

input:

100 21 10 2
5
54

output:

140

result:

ok single line: '140'

Test #87:

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

input:

100 21 10 9
18
21
53
62
85
86
88
90
91

output:

121

result:

ok single line: '121'

Test #88:

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

input:

100 21 10 10
30
39
40
43
45
49
52
57
70
72

output:

132

result:

ok single line: '132'

Test #89:

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

input:

156 20 1 10
19
37
54
70
85
99
112
124
135
145

output:

162

result:

ok single line: '162'

Test #90:

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

input:

156 20 20 10
19
37
54
70
85
99
112
124
135
145

output:

211

result:

ok single line: '211'

Test #91:

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

input:

156 20 30 10
19
37
54
70
85
99
112
124
135
145

output:

211

result:

ok single line: '211'

Test #92:

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

input:

10 2 10 0

output:

50

result:

ok single line: '50'

Test #93:

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

input:

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

output:

10

result:

ok single line: '10'

Test #94:

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

input:

10 2 10 3
2
4
6

output:

20

result:

ok single line: '20'

Test #95:

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

input:

100 2 10 33
2
5
6
9
10
12
18
26
29
30
32
34
35
42
49
50
52
53
55
56
58
61
62
63
69
71
73
74
82
89
91
93
94

output:

356

result:

ok single line: '356'

Test #96:

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

input:

100 2 10 50
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

output:

340

result:

ok single line: '340'

Test #97:

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

input:

100 2 10 50
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99

output:

340

result:

ok single line: '340'

Test #98:

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

input:

100 2 10 50
1
3
5
7
9
11
13
15
17
19
21
23
25
27
29
31
33
35
37
39
41
43
45
47
49
51
53
55
57
59
61
63
65
67
69
71
73
75
77
79
81
83
85
87
89
91
93
95
97
99

output:

101

result:

ok single line: '101'

Test #99:

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

input:

1000 2 10 999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
9...

output:

1000

result:

ok single line: '1000'

Test #100:

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

input:

1000 42 15 100
9
10
31
35
39
42
53
68
75
77
78
92
117
121
123
141
146
147
157
166
167
193
221
222
231
247
255
265
275
292
305
313
341
343
344
352
357
364
371
380
388
392
410
417
418
445
450
451
452
460
476
479
485
498
501
505
515
524
532
539
542
565
569
570
580
581
585
593
607
618
633
634
642
661
66...

output:

1126

result:

ok single line: '1126'

Test #101:

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

input:

1000 42 14 100
8
15
24
35
46
60
71
98
102
113
125
126
159
164
181
183
191
199
208
212
216
217
240
244
264
265
269
275
295
299
308
309
320
321
342
351
389
404
449
468
476
487
502
520
544
556
563
578
580
581
589
593
598
609
610
623
626
631
650
663
668
669
670
679
695
714
740
741
748
759
774
775
794
79...

output:

1151

result:

ok single line: '1151'

Test #102:

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

input:

909 12 12 100
11
21
30
38
45
51
58
66
75
85
96
108
119
129
138
146
153
159
166
174
183
193
204
216
227
237
246
254
261
267
274
282
291
301
312
324
335
345
354
362
369
375
382
390
399
409
420
432
443
453
462
470
477
483
490
498
507
517
528
540
551
561
570
578
585
591
598
606
615
625
636
648
659
669
6...

output:

1207

result:

ok single line: '1207'

Test #103:

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

input:

909 12 13 100
11
21
30
38
45
51
58
66
75
85
96
108
119
129
138
146
153
159
166
174
183
193
204
216
227
237
246
254
261
267
274
282
291
301
312
324
335
345
354
362
369
375
382
390
399
409
420
432
443
453
462
470
477
483
490
498
507
517
528
540
551
561
570
578
585
591
598
606
615
625
636
648
659
669
6...

output:

1207

result:

ok single line: '1207'

Test #104:

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

input:

18 4 5 2
8
15

output:

29

result:

ok single line: '29'

Test #105:

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

input:

18 4 0 2
8
15

output:

18

result:

ok single line: '18'

Test #106:

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

input:

18 10 100 2
8
15

output:

20

result:

ok single line: '20'

Test #107:

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

input:

18 4 100 0

output:

418

result:

ok single line: '418'

Test #108:

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

input:

65 20 100 3
14
25
33

output:

172

result:

ok single line: '172'

Subtask #4:

score: 0
Wrong Answer

Test #109:

score: 15
Accepted
time: 1ms
memory: 5680kb

input:

1000000000000 1 1000000 0

output:

1000000999999000000

result:

ok single line: '1000000999999000000'

Test #110:

score: 15
Accepted
time: 1ms
memory: 5772kb

input:

108 100 10000 5
10
20
30
40
98

output:

110

result:

ok single line: '110'

Test #111:

score: 15
Accepted
time: 1ms
memory: 5848kb

input:

118 100 10000 5
10
20
30
98
108

output:

120

result:

ok single line: '120'

Test #112:

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

input:

206 100 10000 5
10
20
30
98
196

output:

210

result:

ok single line: '210'

Test #113:

score: 15
Accepted
time: 1ms
memory: 5716kb

input:

128 100 10000 5
10
20
98
108
118

output:

130

result:

ok single line: '130'

Test #114:

score: 15
Accepted
time: 0ms
memory: 3816kb

input:

206 100 10000 5
10
20
98
108
196

output:

210

result:

ok single line: '210'

Test #115:

score: 15
Accepted
time: 1ms
memory: 5800kb

input:

216 100 10000 5
10
20
98
196
206

output:

220

result:

ok single line: '220'

Test #116:

score: 15
Accepted
time: 0ms
memory: 5720kb

input:

304 100 10000 5
10
20
98
196
294

output:

310

result:

ok single line: '310'

Test #117:

score: 15
Accepted
time: 0ms
memory: 3680kb

input:

138 100 10000 5
10
98
108
118
128

output:

140

result:

ok single line: '140'

Test #118:

score: 15
Accepted
time: 1ms
memory: 5648kb

input:

206 100 10000 5
10
98
108
118
196

output:

210

result:

ok single line: '210'

Test #119:

score: 15
Accepted
time: 0ms
memory: 3620kb

input:

216 100 10000 5
10
98
108
196
206

output:

220

result:

ok single line: '220'

Test #120:

score: 15
Accepted
time: 1ms
memory: 5660kb

input:

304 100 10000 5
10
98
108
196
294

output:

310

result:

ok single line: '310'

Test #121:

score: 15
Accepted
time: 0ms
memory: 3744kb

input:

226 100 10000 5
10
98
196
206
216

output:

230

result:

ok single line: '230'

Test #122:

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

input:

304 100 10000 5
10
98
196
206
294

output:

310

result:

ok single line: '310'

Test #123:

score: 15
Accepted
time: 0ms
memory: 3616kb

input:

314 100 10000 5
10
98
196
294
304

output:

320

result:

ok single line: '320'

Test #124:

score: 15
Accepted
time: 1ms
memory: 5712kb

input:

402 100 10000 5
10
98
196
294
392

output:

410

result:

ok single line: '410'

Test #125:

score: 15
Accepted
time: 1ms
memory: 5740kb

input:

148 100 10000 5
98
108
118
128
138

output:

150

result:

ok single line: '150'

Test #126:

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

input:

206 100 10000 5
98
108
118
128
196

output:

210

result:

ok single line: '210'

Test #127:

score: 15
Accepted
time: 1ms
memory: 5724kb

input:

216 100 10000 5
98
108
118
196
206

output:

220

result:

ok single line: '220'

Test #128:

score: 15
Accepted
time: 0ms
memory: 3732kb

input:

304 100 10000 5
98
108
118
196
294

output:

310

result:

ok single line: '310'

Test #129:

score: 15
Accepted
time: 0ms
memory: 3752kb

input:

226 100 10000 5
98
108
196
206
216

output:

230

result:

ok single line: '230'

Test #130:

score: 15
Accepted
time: 0ms
memory: 3760kb

input:

304 100 10000 5
98
108
196
206
294

output:

310

result:

ok single line: '310'

Test #131:

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

input:

314 100 10000 5
98
108
196
294
304

output:

320

result:

ok single line: '320'

Test #132:

score: 15
Accepted
time: 0ms
memory: 3760kb

input:

402 100 10000 5
98
108
196
294
392

output:

410

result:

ok single line: '410'

Test #133:

score: 15
Accepted
time: 0ms
memory: 3672kb

input:

236 100 10000 5
98
196
206
216
226

output:

240

result:

ok single line: '240'

Test #134:

score: 15
Accepted
time: 0ms
memory: 3676kb

input:

304 100 10000 5
98
196
206
216
294

output:

310

result:

ok single line: '310'

Test #135:

score: 15
Accepted
time: 0ms
memory: 3680kb

input:

314 100 10000 5
98
196
206
294
304

output:

320

result:

ok single line: '320'

Test #136:

score: 15
Accepted
time: 0ms
memory: 3684kb

input:

402 100 10000 5
98
196
206
294
392

output:

410

result:

ok single line: '410'

Test #137:

score: 15
Accepted
time: 0ms
memory: 3760kb

input:

324 100 10000 5
98
196
294
304
314

output:

330

result:

ok single line: '330'

Test #138:

score: 15
Accepted
time: 1ms
memory: 5796kb

input:

402 100 10000 5
98
196
294
304
392

output:

410

result:

ok single line: '410'

Test #139:

score: 15
Accepted
time: 0ms
memory: 3684kb

input:

412 100 10000 5
98
196
294
392
402

output:

420

result:

ok single line: '420'

Test #140:

score: 15
Accepted
time: 0ms
memory: 3744kb

input:

500 100 10000 5
98
196
294
392
490

output:

510

result:

ok single line: '510'

Test #141:

score: 15
Accepted
time: 0ms
memory: 3688kb

input:

10 2 10 2
1
3

output:

41

result:

ok single line: '41'

Test #142:

score: 15
Accepted
time: 0ms
memory: 5660kb

input:

100 21 10 2
5
54

output:

140

result:

ok single line: '140'

Test #143:

score: 15
Accepted
time: 0ms
memory: 3684kb

input:

100 21 10 9
18
21
53
62
85
86
88
90
91

output:

121

result:

ok single line: '121'

Test #144:

score: 15
Accepted
time: 0ms
memory: 3764kb

input:

100 21 10 10
30
39
40
43
45
49
52
57
70
72

output:

132

result:

ok single line: '132'

Test #145:

score: 15
Accepted
time: 1ms
memory: 5784kb

input:

156 20 1 10
19
37
54
70
85
99
112
124
135
145

output:

162

result:

ok single line: '162'

Test #146:

score: 15
Accepted
time: 1ms
memory: 5716kb

input:

156 20 20 10
19
37
54
70
85
99
112
124
135
145

output:

211

result:

ok single line: '211'

Test #147:

score: 15
Accepted
time: 0ms
memory: 3616kb

input:

156 20 30 10
19
37
54
70
85
99
112
124
135
145

output:

211

result:

ok single line: '211'

Test #148:

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

input:

10 2 10 0

output:

50

result:

ok single line: '50'

Test #149:

score: 15
Accepted
time: 0ms
memory: 3748kb

input:

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

output:

10

result:

ok single line: '10'

Test #150:

score: 15
Accepted
time: 0ms
memory: 3604kb

input:

10 2 10 3
2
4
6

output:

20

result:

ok single line: '20'

Test #151:

score: 15
Accepted
time: 1ms
memory: 5656kb

input:

100 2 10 33
2
5
6
9
10
12
18
26
29
30
32
34
35
42
49
50
52
53
55
56
58
61
62
63
69
71
73
74
82
89
91
93
94

output:

356

result:

ok single line: '356'

Test #152:

score: 15
Accepted
time: 0ms
memory: 3796kb

input:

100 2 10 50
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50

output:

340

result:

ok single line: '340'

Test #153:

score: 15
Accepted
time: 0ms
memory: 3712kb

input:

100 2 10 50
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99

output:

340

result:

ok single line: '340'

Test #154:

score: 15
Accepted
time: 1ms
memory: 5652kb

input:

100 2 10 50
1
3
5
7
9
11
13
15
17
19
21
23
25
27
29
31
33
35
37
39
41
43
45
47
49
51
53
55
57
59
61
63
65
67
69
71
73
75
77
79
81
83
85
87
89
91
93
95
97
99

output:

101

result:

ok single line: '101'

Test #155:

score: 15
Accepted
time: 0ms
memory: 5788kb

input:

1000 2 10 999
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
9...

output:

1000

result:

ok single line: '1000'

Test #156:

score: 15
Accepted
time: 0ms
memory: 3828kb

input:

1000 42 15 100
9
10
31
35
39
42
53
68
75
77
78
92
117
121
123
141
146
147
157
166
167
193
221
222
231
247
255
265
275
292
305
313
341
343
344
352
357
364
371
380
388
392
410
417
418
445
450
451
452
460
476
479
485
498
501
505
515
524
532
539
542
565
569
570
580
581
585
593
607
618
633
634
642
661
66...

output:

1126

result:

ok single line: '1126'

Test #157:

score: 15
Accepted
time: 1ms
memory: 3756kb

input:

1000 42 14 100
8
15
24
35
46
60
71
98
102
113
125
126
159
164
181
183
191
199
208
212
216
217
240
244
264
265
269
275
295
299
308
309
320
321
342
351
389
404
449
468
476
487
502
520
544
556
563
578
580
581
589
593
598
609
610
623
626
631
650
663
668
669
670
679
695
714
740
741
748
759
774
775
794
79...

output:

1151

result:

ok single line: '1151'

Test #158:

score: 15
Accepted
time: 1ms
memory: 5788kb

input:

909 12 12 100
11
21
30
38
45
51
58
66
75
85
96
108
119
129
138
146
153
159
166
174
183
193
204
216
227
237
246
254
261
267
274
282
291
301
312
324
335
345
354
362
369
375
382
390
399
409
420
432
443
453
462
470
477
483
490
498
507
517
528
540
551
561
570
578
585
591
598
606
615
625
636
648
659
669
6...

output:

1207

result:

ok single line: '1207'

Test #159:

score: 15
Accepted
time: 1ms
memory: 5788kb

input:

909 12 13 100
11
21
30
38
45
51
58
66
75
85
96
108
119
129
138
146
153
159
166
174
183
193
204
216
227
237
246
254
261
267
274
282
291
301
312
324
335
345
354
362
369
375
382
390
399
409
420
432
443
453
462
470
477
483
490
498
507
517
528
540
551
561
570
578
585
591
598
606
615
625
636
648
659
669
6...

output:

1207

result:

ok single line: '1207'

Test #160:

score: 15
Accepted
time: 1ms
memory: 3944kb

input:

1000 2 10 333
1
11
12
14
18
19
20
21
22
23
25
27
36
41
43
44
50
54
56
61
64
66
67
69
70
73
74
76
81
83
85
92
95
97
99
115
117
125
126
127
128
137
140
145
148
150
153
156
158
161
165
166
168
169
173
178
179
180
184
187
191
192
195
197
198
201
202
204
205
209
212
213
214
215
218
223
226
227
228
231
23...

output:

3734

result:

ok single line: '3734'

Test #161:

score: 15
Accepted
time: 1ms
memory: 6000kb

input:

1000 2 10 333
2
3
5
6
7
9
10
11
14
15
16
18
19
20
21
25
28
32
33
36
37
38
39
42
43
44
45
46
47
48
49
52
54
56
57
58
59
61
62
63
64
65
66
68
72
73
74
75
76
77
79
80
82
83
84
85
86
87
88
91
92
94
95
96
97
98
100
101
102
103
106
107
109
110
112
117
118
120
121
124
126
128
129
130
133
134
135
136
137
14...

output:

3905

result:

ok single line: '3905'

Test #162:

score: 0
Wrong Answer
time: 3ms
memory: 5716kb

input:

10000 1000 10 333
56
112
142
157
258
264
369
456
487
489
490
564
614
644
662
742
743
789
796
868
880
904
909
937
944
1025
1030
1050
1059
1075
1087
1106
1201
1223
1230
1251
1254
1264
1275
1283
1303
1345
1346
1412
1500
1547
1571
1580
1589
1606
1608
1673
1736
1874
1881
1886
1893
1899
1900
1965
1972
200...

output:

9910

result:

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

Subtask #5:

score: 20
Accepted

Dependency #2:

100%
Accepted

Test #179:

score: 20
Accepted
time: 1ms
memory: 5804kb

input:

1000000000000 1 1000000 0

output:

1000000999999000000

result:

ok single line: '1000000999999000000'

Test #180:

score: 20
Accepted
time: 1ms
memory: 5772kb

input:

108 100 10000 5
10
20
30
40
98

output:

110

result:

ok single line: '110'

Test #181:

score: 20
Accepted
time: 0ms
memory: 3676kb

input:

118 100 10000 5
10
20
30
98
108

output:

120

result:

ok single line: '120'

Test #182:

score: 20
Accepted
time: 1ms
memory: 5716kb

input:

206 100 10000 5
10
20
30
98
196

output:

210

result:

ok single line: '210'

Test #183:

score: 20
Accepted
time: 0ms
memory: 5720kb

input:

128 100 10000 5
10
20
98
108
118

output:

130

result:

ok single line: '130'

Test #184:

score: 20
Accepted
time: 0ms
memory: 5652kb

input:

206 100 10000 5
10
20
98
108
196

output:

210

result:

ok single line: '210'

Test #185:

score: 20
Accepted
time: 1ms
memory: 3660kb

input:

216 100 10000 5
10
20
98
196
206

output:

220

result:

ok single line: '220'

Test #186:

score: 20
Accepted
time: 1ms
memory: 5720kb

input:

304 100 10000 5
10
20
98
196
294

output:

310

result:

ok single line: '310'

Test #187:

score: 20
Accepted
time: 0ms
memory: 3736kb

input:

138 100 10000 5
10
98
108
118
128

output:

140

result:

ok single line: '140'

Test #188:

score: 20
Accepted
time: 0ms
memory: 3744kb

input:

206 100 10000 5
10
98
108
118
196

output:

210

result:

ok single line: '210'

Test #189:

score: 20
Accepted
time: 0ms
memory: 3736kb

input:

216 100 10000 5
10
98
108
196
206

output:

220

result:

ok single line: '220'

Test #190:

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

input:

304 100 10000 5
10
98
108
196
294

output:

310

result:

ok single line: '310'

Test #191:

score: 20
Accepted
time: 0ms
memory: 5660kb

input:

226 100 10000 5
10
98
196
206
216

output:

230

result:

ok single line: '230'

Test #192:

score: 20
Accepted
time: 1ms
memory: 5796kb

input:

304 100 10000 5
10
98
196
206
294

output:

310

result:

ok single line: '310'

Test #193:

score: 20
Accepted
time: 1ms
memory: 5796kb

input:

314 100 10000 5
10
98
196
294
304

output:

320

result:

ok single line: '320'

Test #194:

score: 20
Accepted
time: 1ms
memory: 5716kb

input:

402 100 10000 5
10
98
196
294
392

output:

410

result:

ok single line: '410'

Test #195:

score: 20
Accepted
time: 0ms
memory: 3816kb

input:

148 100 10000 5
98
108
118
128
138

output:

150

result:

ok single line: '150'

Test #196:

score: 20
Accepted
time: 1ms
memory: 5800kb

input:

206 100 10000 5
98
108
118
128
196

output:

210

result:

ok single line: '210'

Test #197:

score: 20
Accepted
time: 0ms
memory: 3756kb

input:

216 100 10000 5
98
108
118
196
206

output:

220

result:

ok single line: '220'

Test #198:

score: 20
Accepted
time: 0ms
memory: 5800kb

input:

304 100 10000 5
98
108
118
196
294

output:

310

result:

ok single line: '310'

Test #199:

score: 20
Accepted
time: 0ms
memory: 5796kb

input:

226 100 10000 5
98
108
196
206
216

output:

230

result:

ok single line: '230'

Test #200:

score: 20
Accepted
time: 1ms
memory: 5644kb

input:

304 100 10000 5
98
108
196
206
294

output:

310

result:

ok single line: '310'

Test #201:

score: 20
Accepted
time: 0ms
memory: 3680kb

input:

314 100 10000 5
98
108
196
294
304

output:

320

result:

ok single line: '320'

Test #202:

score: 20
Accepted
time: 1ms
memory: 5772kb

input:

402 100 10000 5
98
108
196
294
392

output:

410

result:

ok single line: '410'

Test #203:

score: 20
Accepted
time: 0ms
memory: 3760kb

input:

236 100 10000 5
98
196
206
216
226

output:

240

result:

ok single line: '240'

Test #204:

score: 20
Accepted
time: 0ms
memory: 3768kb

input:

304 100 10000 5
98
196
206
216
294

output:

310

result:

ok single line: '310'

Test #205:

score: 20
Accepted
time: 0ms
memory: 3676kb

input:

314 100 10000 5
98
196
206
294
304

output:

320

result:

ok single line: '320'

Test #206:

score: 20
Accepted
time: 1ms
memory: 5772kb

input:

402 100 10000 5
98
196
206
294
392

output:

410

result:

ok single line: '410'

Test #207:

score: 20
Accepted
time: 1ms
memory: 5704kb

input:

324 100 10000 5
98
196
294
304
314

output:

330

result:

ok single line: '330'

Test #208:

score: 20
Accepted
time: 0ms
memory: 3672kb

input:

402 100 10000 5
98
196
294
304
392

output:

410

result:

ok single line: '410'

Test #209:

score: 20
Accepted
time: 1ms
memory: 5712kb

input:

412 100 10000 5
98
196
294
392
402

output:

420

result:

ok single line: '420'

Test #210:

score: 20
Accepted
time: 0ms
memory: 3756kb

input:

500 100 10000 5
98
196
294
392
490

output:

510

result:

ok single line: '510'

Test #211:

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

input:

10 2 10 2
1
3

output:

41

result:

ok single line: '41'

Test #212:

score: 20
Accepted
time: 1ms
memory: 5784kb

input:

100 21 10 2
5
54

output:

140

result:

ok single line: '140'

Test #213:

score: 20
Accepted
time: 0ms
memory: 3616kb

input:

100 21 10 9
18
21
53
62
85
86
88
90
91

output:

121

result:

ok single line: '121'

Test #214:

score: 20
Accepted
time: 1ms
memory: 5780kb

input:

100 21 10 10
30
39
40
43
45
49
52
57
70
72

output:

132

result:

ok single line: '132'

Test #215:

score: 20
Accepted
time: 0ms
memory: 3664kb

input:

156 20 1 10
19
37
54
70
85
99
112
124
135
145

output:

162

result:

ok single line: '162'

Test #216:

score: 20
Accepted
time: 0ms
memory: 3684kb

input:

156 20 20 10
19
37
54
70
85
99
112
124
135
145

output:

211

result:

ok single line: '211'

Test #217:

score: 20
Accepted
time: 0ms
memory: 5656kb

input:

156 20 30 10
19
37
54
70
85
99
112
124
135
145

output:

211

result:

ok single line: '211'

Test #218:

score: 20
Accepted
time: 84ms
memory: 90360kb

input:

1000000 100 10 100000
1
8
9
10
12
16
17
20
21
22
23
24
28
30
31
32
34
37
38
41
48
51
58
59
61
63
66
68
70
73
77
79
80
81
82
85
89
90
91
92
96
97
99
100
101
102
105
109
110
111
112
114
115
117
120
123
126
127
130
134
138
139
141
142
144
145
149
150
158
160
161
162
167
169
170
174
175
178
182
185
187
...

output:

1081682

result:

ok single line: '1081682'

Test #219:

score: 20
Accepted
time: 71ms
memory: 90472kb

input:

1000000 100 10 100000
10
14
18
21
22
27
40
42
50
59
105
114
132
142
151
152
166
190
196
197
202
205
210
222
238
241
259
287
288
293
304
309
321
340
350
368
384
385
417
427
437
491
498
526
530
555
556
570
576
589
600
610
620
635
642
644
666
708
709
710
718
727
730
749
751
763
770
782
811
813
815
816
...

output:

1047315

result:

ok single line: '1047315'

Test #220:

score: 20
Accepted
time: 0ms
memory: 6088kb

input:

1000000 100 8 1000
39
1562
1649
2355
4738
4889
5142
5261
5649
6214
8152
8899
11790
11870
12496
12920
13274
13996
14469
14584
18250
18558
18721
21209
26066
26370
26467
27204
28674
28739
30820
31931
32616
36035
36273
38274
39402
39478
41017
41088
43831
43989
45860
46628
46890
49500
51612
52134
52298
5...

output:

1079383

result:

ok single line: '1079383'

Test #221:

score: 20
Accepted
time: 2ms
memory: 6012kb

input:

1000000 100 25 1000
358
1131
1624
2168
2197
3061
3352
3720
3724
3827
4886
5151
5211
8470
10498
11335
13236
13844
14420
15046
15327
16217
17619
18234
18244
19212
20943
21464
21836
22292
23847
24140
25412
27162
27692
30075
32753
33232
35108
35629
35995
38608
39475
40188
40294
40988
41281
41464
41849
4...

output:

1245648

result:

ok single line: '1245648'

Test #222:

score: 20
Accepted
time: 0ms
memory: 4480kb

input:

1000000 100 50 1000
4919
6240
8211
8257
9364
12447
13429
13497
15222
15796
16384
17405
17565
17645
19549
20799
22133
26147
26661
26693
27934
30937
33712
34681
34952
35577
38573
40010
40582
40760
41303
41342
41578
46052
48398
49197
49253
49514
49556
51014
51217
51777
53168
53734
53856
55366
56381
578...

output:

1486984

result:

ok single line: '1486984'

Test #223:

score: 20
Accepted
time: 79ms
memory: 90324kb

input:

7500099 100 100 100000
99
197
294
390
485
579
672
764
855
945
1034
1122
1209
1295
1380
1464
1547
1629
1710
1790
1869
1947
2024
2100
2175
2249
2322
2394
2465
2535
2604
2672
2739
2805
2870
2934
2997
3059
3120
3180
3239
3297
3354
3410
3465
3519
3572
3624
3675
3725
3776
3828
3881
3935
3990
4046
4103
416...

output:

10000099

result:

ok single line: '10000099'

Test #224:

score: 20
Accepted
time: 84ms
memory: 90376kb

input:

7500099 100 101 100000
99
197
294
390
485
579
672
764
855
945
1034
1122
1209
1295
1380
1464
1547
1629
1710
1790
1869
1947
2024
2100
2175
2249
2322
2394
2465
2535
2604
2672
2739
2805
2870
2934
2997
3059
3120
3180
3239
3297
3354
3410
3465
3519
3572
3624
3675
3725
3776
3828
3881
3935
3990
4046
4103
416...

output:

10000099

result:

ok single line: '10000099'

Test #225:

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

input:

18 4 5 2
8
15

output:

29

result:

ok single line: '29'

Test #226:

score: 20
Accepted
time: 0ms
memory: 5724kb

input:

18 4 0 2
8
15

output:

18

result:

ok single line: '18'

Test #227:

score: 20
Accepted
time: 0ms
memory: 3812kb

input:

18 10 100 2
8
15

output:

20

result:

ok single line: '20'

Test #228:

score: 20
Accepted
time: 0ms
memory: 5640kb

input:

18 4 100 0

output:

418

result:

ok single line: '418'

Test #229:

score: 20
Accepted
time: 0ms
memory: 3616kb

input:

65 20 100 3
14
25
33

output:

172

result:

ok single line: '172'

Subtask #6:

score: 0
Skipped

Dependency #1:

0%

Subtask #7:

score: 0
Skipped

Dependency #1:

0%