#include <bits/stdc++.h> typedef long long ll; const int maxx = 100010; const int inf = 0x3f3f3f3f; using namespace std; char s[maxx]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t; cin >> t; while (t--) { int n, a, b; cin >> n >> a >> b; char c = 'a'; memset(s, 0, sizeof(s)); for (int i = 0; i < a; i++) { if (i < b) s[i] = c + i; else s[i] = 'a'; cout << s[i]; } for (int i = a; i < n; i++) cout << s[i % a]; cout << endl; } return 0; }
#include <bits/stdc++.h> typedef long long ll; const int maxx = 200010; const int inf = 0x3f3f3f3f; using namespace std; int a[maxx]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int t, n; cin >> t; while (t--) { cin >> n; map<int, int> h; set<int> s; for (int i = 1; i <= n; i++) { cin >> a[i]; h[a[i]]++; s.insert(a[i]); } int cnt = s.size(); int m = 0; for (int i = 1; i <= n; i++) { if (cnt > h[a[i]]) m = max(m, h[a[i]]); else if (cnt == h[a[i]]) m = max(m, h[a[i]] - 1); else m = max(m, cnt); } cout << m << endl; } return 0; }