Advertisement
Guest User

Untitled

a guest
Feb 21st, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. #include <iostream>
  2. #include <fstream>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7. ifstream fin("avarcolaci.in");
  8. ofstream fout("avarcolaci.out");
  9.  
  10. #define nmax 105
  11.  
  12. int T,n,x,nr=0,task,nrf=0,t[nmax];
  13.  
  14. int main()
  15. {
  16. fin>>T;
  17. for(int i=1;i<=T;i++)
  18. {
  19. fin>>n;
  20. nr=0;
  21. task=0;
  22. for(int j=1;j<=n*2;j++)
  23. {
  24. fin>>x;
  25. if(!nr)
  26. {
  27. nr++;
  28. task=x;
  29. }
  30. else
  31. {
  32. if(task!=x)
  33. nr--;
  34. else
  35. nr++;
  36. }
  37. }
  38. t[i]=task;
  39. }
  40. fin.close();
  41. ifstream fin("avarcolaci.in");
  42. fin>>T;
  43. for(int i=1;i<=T;i++)
  44. {
  45. fin>>n;
  46. nrf=0;
  47. for(int j=1;j<=n*2;j++)
  48. {
  49. fin>>x;
  50. if(x==t[i])
  51. nrf++;
  52. }
  53. if(nrf>n)
  54. fout<<t[i]<<'\n';
  55. else
  56. fout<<"Mozart"<<'\n';
  57. }
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement