Advertisement
Guest User

Untitled

a guest
Dec 4th, 2014
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. #include<iostream>
  2. #include<cstdio>
  3. #include<cstring>
  4. #include<cstdlib>
  5. #include<climits>
  6. #include<cmath>
  7. #include<string>
  8. #include<sstream>
  9. #include<vector>
  10. #include<list>
  11. #include<deque>
  12. #include<stack>
  13. #include<queue>
  14. #include<set>
  15. #include<map>
  16. #include<algorithm>
  17. #include<iterator>
  18. #include<numeric>
  19. #include<fstream>
  20.  
  21. #define FORF(i,a,b) for(int i=a; i<=b; ++i)
  22. #define FORB(i,a,b) for(int i=a; i>=b; --i)
  23. #define ALL(v) v.begin(),v.end()
  24. #define min3(a,b,c) min(min(a,b),c)
  25. #define SIZE 100010
  26. #define MAXN 3000000
  27.  
  28. using namespace std;
  29.  
  30.  
  31. typedef long long LL;
  32.  
  33.  
  34. struct basket
  35. {
  36. int team;
  37. LL dist;
  38.  
  39. friend bool operator<(basket b1,basket b2)
  40. {
  41. return b1.dist<b2.dist;
  42. }
  43. };
  44.  
  45. int N,M;
  46. int cnt1,cnt2;
  47. LL scA,scB,cuA,cuB;
  48.  
  49.  
  50. int main()
  51. {
  52. basket bsk[SIZE];
  53.  
  54. scanf("%d",&N);
  55. FORF(i,0,N-1)
  56. {
  57. scanf("%d",&bsk[i].dist);
  58. bsk[i].team=1;
  59. }
  60.  
  61. scanf("%d",&M);
  62. FORF(i,0,M-1)
  63. {
  64. scanf("%d",&bsk[i+N].dist);
  65. bsk[i+N].team=2;
  66. }
  67.  
  68.  
  69. sort(bsk,bsk+N+M);
  70.  
  71.  
  72. scA=3*N;
  73. scB=3*M;
  74. for(int i=0; i<N+M;)
  75. {
  76. do
  77. {
  78. if(bsk[i].team==1)
  79. ++cnt1;
  80. else
  81. ++cnt2;
  82.  
  83. ++i;
  84.  
  85. }while(i<N+M && bsk[i-1].dist==bsk[i].dist);
  86.  
  87.  
  88. cuA=2*cnt1 + 3*(N-cnt1);
  89. cuB=2*cnt2 + 3*(M-cnt2);
  90.  
  91.  
  92. if(cuA-cuB>scA-scB || (cuA-cuB==scA-scB && cuA>scA))
  93. {
  94. scA=cuA;
  95. scB=cuB;
  96. }
  97. }
  98.  
  99.  
  100. printf("%I64d:%I64d\n",scA,scB);
  101.  
  102.  
  103. return 0;
  104. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement