Advertisement
erfanul007

Untitled

Jan 12th, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.32 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. typedef long long int ll;
  5. typedef unsigned long long int ull;
  6. typedef vector<int> vi;
  7. typedef vector<ll> vll;
  8. typedef vector<vi> vvi;
  9. typedef pair<int,int> pii;
  10. typedef vector< pii > vpii;
  11. typedef set<int> sti;
  12.  
  13. #define pb push_back
  14. #define pob pop_back
  15. #define mp make_pair
  16. #define ff first
  17. #define ss second
  18. #define loop1(i,n) for(int i=1; i<=int(n); i++)
  19. #define loop(i,y) for(int i=0; i<int(y); i++)
  20. #define rloop(i,y) for(int i=int(y); i>0; i--)
  21. #define rloop1(i,y) for(int i=int(y)-1; i>=0; i--)
  22. #define read() freopen("input.txt", "r", stdin)
  23. #define write() freopen("output.txt", "w", stdout)
  24. #define cspf(i) printf("Case %d: ", i)
  25. #define all(v) v.begin(),v.end()
  26. /// Constants
  27. #define eps 1e-9
  28. #define PI acos(-1.0) // 3.1415926535897932
  29.  
  30. int main()
  31. {
  32. read();
  33. write();
  34. int t;
  35. cin>>t;
  36. loop1(i,t){
  37. int n;
  38. cin>>n;
  39. vi my(n),op(n),flg(n);
  40. loop(j,n)
  41. cin>>my[j];
  42. loop(j,n)
  43. cin>>op[j];
  44. loop(j,n)
  45. flg[j]=0;
  46. int cnt=0;
  47. sort(all(my));
  48. cout<<"my= ";
  49. loop(j,n)
  50. printf("%4d",my[j]);
  51. cout<<endl;
  52. cout<<"op= ";
  53. sort(all(op));
  54. loop(j,n)
  55. printf("%4d",op[j]);
  56. cout<<endl;
  57. loop(j,n){
  58. int b=0,x;
  59. loop(k,n){
  60. if(flg[k]==2 || flg[k]==1)
  61. continue;
  62. cspf(j);
  63. printf("my=%d op=%d\n",my[j],op[k]);
  64. if(my[j]<op[k])
  65. break;
  66. if(flg[k]==0){
  67. printf("mew:");
  68. if(my[j]>op[k]){
  69. flg[k]=2;
  70. b=2;
  71. printf("# my=%d op=%d\n",my[j],op[k]);
  72. break;
  73. }
  74. if(my[j]==op[k]){
  75. flg[k]=1;
  76. b=1;
  77. printf("& my=%d op=%d\n",my[j],op[k]);
  78. x=k;
  79. break;
  80. }
  81. }
  82. }
  83. if(b==0){
  84. loop(k,n){
  85. if(my[j]<op[k])
  86. break;
  87. if(my[j]>op[k] && flg[k]==1){
  88. flg[k]=2;
  89. printf("#my=%d op=%d\n",my[j],op[k]);
  90. }
  91. }
  92. }
  93. if(b==1){
  94. loop(k,n){
  95. if(my[j]<op[k])
  96. break;
  97. if(my[j]>op[k] && flg[k]==1){
  98. flg[k]=2;
  99. flg[x]=0;
  100. printf("&my=%d op=%d\n",my[j],op[k]);
  101. break;
  102. }
  103. }
  104. }
  105. printf("\n");
  106. }
  107. loop(j,n){
  108. cspf(j);
  109. printf("%d\n",flg[j]);
  110. cnt+=flg[j];
  111. }
  112. cspf(i);
  113. cout<<cnt<<endl;
  114. }
  115. return 0;
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement