fork(1) download
  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <cstring>
  4. #include <vector>
  5. #include <algorithm>
  6. using namespace std;
  7. //3:48 PM
  8. int main() {
  9. int T;
  10. int number;
  11. scanf("%d",&T);
  12. while(T-->0)
  13. {
  14. int max=0,number1;
  15. scanf("%d",&number);
  16. vector<int>array(10000);
  17. fill(array.begin(),array.end(),0);
  18. for(int i=0;i<number;i++)
  19. {
  20. scanf("%d",&number1);
  21. array[number1]++;
  22. }
  23. int max1=0,index=0;
  24. for(int i=0;i<10000;i++)
  25. if(array[i]>max1)
  26. {
  27. max1=array[i];
  28. index=i;
  29. }
  30. printf("%d %d\n",index,max1);
  31. array.clear();
  32. }
  33. return 0;
  34. } //Finish 3:52
Success #stdin #stdout 0s 3432KB
stdin
1
6
10000 10000 12 389 23 2
stdout
2 1