| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1331959 | Zone_zonee | Telefoni (COCI17_telefoni) | C++20 | 9 ms | 1604 KiB |
#include <bits/stdc++.h>
using namespace std;
const int N = 3e5+10;
int a[N];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, k;
cin >> n >> k;
for(int i = 1; i <= n; ++i) cin >> a[i], a[i] += a[i-1];
int idx = 1;
int res = 0;
while(idx < n){
int nxt = lower_bound(a+idx, a+min(n, idx+k), a[min(n, idx+k)]) - a;
if(nxt == idx){
res++;
idx = idx+k;
}else{
idx = nxt;
}
}
cout << res << '\n';
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
