Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- typedef long long int ll;
- typedef unsigned long long int ull;
- typedef vector<int> vi;
- typedef vector<ll> vll;
- typedef vector<vi> vvi;
- typedef pair<int,int> pii;
- typedef vector< pii > vpii;
- typedef set<int> sti;
- #define pb push_back
- #define pob pop_back
- #define mp make_pair
- #define ff first
- #define ss second
- #define loop1(i,n) for(int i=1; i<=int(n); i++)
- #define loop(i,y) for(int i=0; i<int(y); i++)
- #define rloop(i,y) for(int i=int(y); i>0; i--)
- #define rloop1(i,y) for(int i=int(y)-1; i>=0; i--)
- #define read() freopen("input.txt", "r", stdin)
- #define write() freopen("output.txt", "w", stdout)
- #define cspf(i) printf("Case %d: ", i)
- #define all(v) v.begin(),v.end()
- /// Constants
- #define eps 1e-9
- #define PI acos(-1.0) // 3.1415926535897932
- int main()
- {
- read();
- write();
- int t;
- cin>>t;
- loop1(i,t){
- int n;
- cin>>n;
- vi my(n),op(n),flg(n);
- loop(j,n)
- cin>>my[j];
- loop(j,n)
- cin>>op[j];
- loop(j,n)
- flg[j]=0;
- int cnt=0;
- sort(all(my));
- cout<<"my= ";
- loop(j,n)
- printf("%4d",my[j]);
- cout<<endl;
- cout<<"op= ";
- sort(all(op));
- loop(j,n)
- printf("%4d",op[j]);
- cout<<endl;
- loop(j,n){
- int b=0,x;
- loop(k,n){
- if(flg[k]==2 || flg[k]==1)
- continue;
- cspf(j);
- printf("my=%d op=%d\n",my[j],op[k]);
- if(my[j]<op[k])
- break;
- if(flg[k]==0){
- printf("mew:");
- if(my[j]>op[k]){
- flg[k]=2;
- b=2;
- printf("# my=%d op=%d\n",my[j],op[k]);
- break;
- }
- if(my[j]==op[k]){
- flg[k]=1;
- b=1;
- printf("& my=%d op=%d\n",my[j],op[k]);
- x=k;
- break;
- }
- }
- }
- if(b==0){
- loop(k,n){
- if(my[j]<op[k])
- break;
- if(my[j]>op[k] && flg[k]==1){
- flg[k]=2;
- printf("#my=%d op=%d\n",my[j],op[k]);
- }
- }
- }
- if(b==1){
- loop(k,n){
- if(my[j]<op[k])
- break;
- if(my[j]>op[k] && flg[k]==1){
- flg[k]=2;
- flg[x]=0;
- printf("&my=%d op=%d\n",my[j],op[k]);
- break;
- }
- }
- }
- printf("\n");
- }
- loop(j,n){
- cspf(j);
- printf("%d\n",flg[j]);
- cnt+=flg[j];
- }
- cspf(i);
- cout<<cnt<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement