组合数(2次方级)的组合
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=998244353;
void solve(){
int n;
cin>>n;
vector<int>a(n+1);
for(int i=1;i<=n;i++)cin>>a[i];
map<int,int>mp;
for(int i=1;i<=n;i++){
int x;
cin>>x;
mp[a[i]]=x;
}
int m;
cin>>m;
vector<int>b(m+1);
for(int i=1;i<=m;i++)cin>>b[i];
map<int,int>mp2;
for(int i=1;i<=m;i++){
int x;
cin>>x;
mp2[b[i]]=x;
}
int ans=0;
for(auto c:mp2){
int u=c.first;
if(mp2[u]>mp[u]){
cout<<0<<"\n";
return;
}else{
mp[u]-=mp2[u];
}
}
for(auto c:mp){
if(c.second>0)ans++;
}
int h=1;
for(int i=1;i<=ans;i++){
h=h*2%mod;
}
cout<<h<<"\n";
}
signed main(){
ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int t=1;
//cin>>t;
for(int i=1;i<=t;i++)solve();
return 0;
}
标签:16,int,Battling,long,mp2,Numbers,ans,mp
From: https://www.cnblogs.com/yufan1102/p/17973561