Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <algorithm>
- using namespace std;
- ifstream fin("avarcolaci.in");
- ofstream fout("avarcolaci.out");
- #define nmax 105
- int T,n,x,nr=0,task,nrf=0,t[nmax];
- int main()
- {
- fin>>T;
- for(int i=1;i<=T;i++)
- {
- fin>>n;
- nr=0;
- task=0;
- for(int j=1;j<=n*2;j++)
- {
- fin>>x;
- if(!nr)
- {
- nr++;
- task=x;
- }
- else
- {
- if(task!=x)
- nr--;
- else
- nr++;
- }
- }
- t[i]=task;
- }
- fin.close();
- ifstream fin("avarcolaci.in");
- fin>>T;
- for(int i=1;i<=T;i++)
- {
- fin>>n;
- nrf=0;
- for(int j=1;j<=n*2;j++)
- {
- fin>>x;
- if(x==t[i])
- nrf++;
- }
- if(nrf>n)
- fout<<t[i]<<'\n';
- else
- fout<<"Mozart"<<'\n';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement