#include #include using namespace std; #define NMAX 1500 typedef struct s{ int A,cnt; } S; bool operator<(S a,S b){ return a.A>N; for(int i=0;i>A[i].A; A[i].cnt=0; Atmp[i]=A[i]; } for(int i=0;i>B[i]; ans=N+1; for(int i=0;itmp.A||(A[k].A==tmp.A&&A[k].cnt>tmp.cnt)){ A[k-1]=tmp; break; } A[k-1]=A[k]; } } int maxf=-1; for(int k=0;kmaxf) maxf=A[k].cnt; } if(ans>maxf) ans=maxf; } cout<