fork download
  1. #include<cstdio>
  2. #include<cstdlib>
  3. #include<algorithm>
  4. int n,i,j,k,I,J,la,lb,N[111111];
  5. long long a,b,A,B;
  6. int main()
  7. {
  8. for(scanf("%d",&n);i<n;scanf("%d",N+i++));
  9. std::sort(N,N+n--);
  10. if(N[i=a=b=0]!=N[j=la=lb=n])for(;;)
  11. {
  12. if(la){for(la=0,I=i;N[++I]==N[i];);A=a+I;}
  13. if(lb){for(lb=0,J=j;N[--J]==N[j];);B=b+n-J;}
  14. if(N[J]<N[I])break;
  15. B<A?(b=B,lb=1,j=J):(a=A,la=1,i=I);
  16. }
  17. printf("%sko\n%d %d\n",a<=b?"Slav":"Mir",N[i],N[j]);
  18. return 0;
  19. }
Success #stdin #stdout 0s 3732KB
stdin
7
2 1 3 3 5 4 1
stdout
Slavko
2 3