Nộp bài | Các bài nộp | Làm tốt nhất | Về danh sách bài |
Problem hidden on 2014-10-16 12:55:56 by VOJ Team
QTGIFT1 - New year love story |
English | Vietnamese |
With brother’s help, DB has successed in flirt with TN. (see QTNOEL). But now he has another problem :
In Vietnamese Tet holidays (Vietnam’s Lunar New Year), there is a custom called ‘Li xi’ that adult give children money in red packs, to wish them strong and happy. DB’s family has a very special method to give children Li xi :
There are n Li xi packs, every pack has a[i] VND – Vietnamese unit of money, and a random positive integer k (1 ≤ k ≤ n). DB can take any pack, but mustn’t take k packs in a row.
Let’s help him to find the way to take the maximum of money.
Input :
- First line : two integer n and k
- Second line : n integer, the i-th number is a[i]
Output :
A single number s – the maximum money DB can take.
Example:
Input:
5 3
6 19 8 7 13
Output:
45
Limit :
- 0 ≤ a[i] ≤ 2000
- n ≤ 106
Được gửi lên bởi: | Coder nhà mình |
Ngày: | 2014-01-20 |
Thời gian chạy: | 1s |
Giới hạn mã nguồn: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Ngôn ngữ cho phép: | Tất cả ngoại trừ: ASM64 GOSU PERL6 PYPY RUST SED |
Nguồn bài: | Tài liệu chuyên tin |
hide comments
|
|||||
2024-10-15 16:35:56
test vi du bo di so 8 thoi |
|||||
2019-07-28 05:41:58
QHĐ AC |
|||||
2019-04-10 17:21:16
. Last edit: 2019-04-16 10:36:21 |
|||||
2019-01-27 15:13:51
time chặt quá, cin cout + ios cũng không qua nhé các bạn :(( |
|||||
2018-06-21 22:46:35
không có g.han gì cả |
|||||
2018-06-10 10:06:49
dizzz anh khoong doi qua :D |
|||||
2017-11-27 16:49:31
O(N log2(N)) vẫn bị TLE. Bài này bắt O(N) mới qua. Deque tìm min/max AC. |
|||||
2017-08-03 20:14:32
so eazy |
|||||
2016-04-17 09:42:46
n log n ko acc???? |
|||||
2015-10-26 03:12:48 _sanghk11_
có lẽ o ( n log n ) ko ac :v Last edit: 2015-10-27 15:53:03 |