首先,Bob 同一颜色 Alice 则相反
我去看Bob的情况(no)
如果Bob想要同一颜色 也就是至少需要n-k个颜色 如果<这个说明我Bob就out了
所以我们尽量均匀分布的最大值即可得出最后的答案
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cerr << #x << ": " << x << '\n';
void solve() {
int n, m, k; cin >> n >> m >> k;
int x = (n + m - 1) / m;
cout << (x + k >= n ? "No\n" : "Yes\n");
}
int main() {
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int T; cin >> T;
while (T--) {
solve();
}
return 0;
}
#include<bits/stdc++.h>
using namespace std;
#define debug(x) cerr << #x << ": " << x << '\n';
void solve() {
int n; cin >> n;
vector <int> a(n + 1);
bool ok = 0;
for (int i = 1; i <= n; i++) {
cin >> a[i];
if (a[i] != a[1]) ok = 1;
}
if (!ok) {
cout << -1 << '\n';
return ;
}
int ans = n, r = 0;
for (int i = 1; i <= n; i++) {
if (a[i] != a[1]) {
ans = min(ans, i - r - 1);
r = i;
}
}
cout << min(ans, n - r) << '\n';
return ;
}
int main() {
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
int T; cin >> T;
while (T--) {
solve();
}
return 0;
}