vijos 1641 Vs Snowy
代码:
#include<set> #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> using namespace std; set<string> mac; int T,n,k,m; string s; int main(){ scanf("%d",&T); m=T; while(T--){ int ans=0; scanf("%d%d",&n,&k); mac.clear(); for(int i=1;i<=n;i++) cin>>s; for(int i=1;i<=k;i++){ cin>>s; mac.insert(s); if(mac.size()==n) { mac.clear(); ans++; mac.insert(s); } } printf("For %d# problem we need %d\n",m-T,ans); } return 0; }
一世安宁