Advertisement
bibaboba12345

ХУЙ

Oct 25th, 2021
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <iostream>
  3. #include <algorithm>
  4. #include <vector>
  5. #include <cmath>
  6. #include<iomanip>
  7. #include<map>
  8. using namespace std;
  9. const int INF = 1e9, N = 6e5;
  10. string s, s1;
  11. int t, i, n ,q,x,k;
  12. int a[2002][4004];
  13. map<int, int> cnt;
  14. int main()
  15. {
  16. ios::sync_with_stdio(false);
  17. cin.tie(0);
  18. cin >> t;
  19. for (int I = 0; I < t; I++) {
  20. cin >> n;
  21. for (i = 0; i < n; i++) {
  22. cin >> a[i][0];
  23. }
  24. for (int step = 0; step < 4002; step++) {
  25. cnt.clear();
  26. for (i = 0; i < n; i++) {
  27. cnt[a[i][step]]++;
  28. }
  29. for (i = 0; i < n; i++) {
  30. a[i][step + 1] = cnt[a[i][step]];
  31. }
  32. }
  33. cin >> q;
  34. for (i = 0; i < q; i++) {
  35. cin >> x >> k;
  36. k = min(k, 4002);
  37. cout << a[x-1][k] << "\n";
  38. }
  39. cout << "\n";
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement