-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathB.cpp
More file actions
39 lines (37 loc) · 689 Bytes
/
Copy pathB.cpp
File metadata and controls
39 lines (37 loc) · 689 Bytes
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
#include <bits/stdc++.h>
using namespace std;
template <typename T> int len(const T& a) { return a.size(); }
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int tc;
cin >> tc;
while (tc--) {
int n, k;
cin >> n >> k;
vector<int> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i];
}
int mn = INT_MAX;
for (int c = 1; c <= 100; ++c) {
int now = 0;
int days = 0;
for (int j = 0; j < n; ++j) {
if (a[j] != c || now != 0) {
now++;
if (now == k) {
days++;
now = 0;
}
}
}
if (now > 0) {
days++;
}
mn = min(mn, days);
}
cout << mn << '\n';
}
return 0;
}