https://codeforces.com/gym/580226/problem/C
#include<bits/stdc++.h>
#define lc p<<1
#define rc p<<1|1
#define INF 2e9
using namespace std;
#define endl '\n'
using ll = long long;
using pii = pair<ll, ll>;
const double PI = acos(-1);
const int N=1e4+10;
void solve(){
//方一 推荐
// map<string,int>mp;
// int n;cin>>n;
// for(int i=1;i<=n;i++){
// string s;cin>>s;
// mp[s]++;
// }
// int ans=0;
// for(int i=1;i<=n;i++){
// string s;cin>>s;
// if(mp[s]) {
// mp[s]--;
// }
// else {
// ans++;
// }
// }
// cout<<ans;
int S1=0,M1=0,L1=0;
int XS1=0,XL1=0;
int XXS1=0,XXL1=0;
int XXXS1=0,XXXL1=0;
int S2=0,M2=0,L2=0;
int XS2=0,XL2=0;
int XXS2=0,XXL2=0;
int XXXS2=0,XXXL2=0;
int n;cin>>n;
for(int i=1;i<=n;i++){
string s;cin>>s;
if(s=="S") S1++;
else if(s=="M") M1++;
else if(s=="L") L1++;
else if(s=="XS") XS1++;
else if(s=="XL") XL1++;
else if(s=="XXL") XXL1++;
else if(s=="XXS") XXS1++;
else if(s=="XXXL") XXXL1++;
else XXXS1++;
}
for(int i=1;i<=n;i++){
string s;cin>>s;
if(s=="S") S2++;
else if(s=="M") M2++;
else if(s=="L") L2++;
else if(s=="XS") XS2++;
else if(s=="XL") XL2++;
else if(s=="XXL") XXL2++;
else if(s=="XXS") XXS2++;
else if(s=="XXXL") XXXL2++;
else XXXS2++;
}
ll ans=min(S1,S2)+min(M1,M2)+min(L1,L2)+min(XS1,XS2)+min(XL1,XL2)+min(XXL1,XXL2)+min(XXS1,XXS2)+min(XXXL1,XXXL2)+min(XXXS1,XXXS2);
// cout<<ans<<endl;
cout<<n-ans;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
int T = 1;
// cin>>T;
while (T--) {
solve();
}
return 0;
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库