# UPC-混合训练第十五场

3
1 2
2
1 1
2 2
1 1
1 2
5 2
2 1 1 1 0
0 5


Yes
No
No


#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define HEAP(...) priority_queue<__VA_ARGS__ >
#define heap(...) priority_queue<__VA_ARGS__,vector<__VA_ARGS__ >,greater<__VA_ARGS__ > >
template<class T> inline T min(T &x,const T &y){return x>y?y:x;}
template<class T> inline T max(T &x,const T &y){return x<y?y:x;}
ll read(){ll c = getchar(),Nig = 1,x = 0;while(!isdigit(c) && c!='-')c = getchar();
if(c == '-')Nig = -1,c = getchar();
while(isdigit(c))x = ((x<<1) + (x<<3)) + (c^'0'),c = getchar();
return Nig*x;}
const ll inf = 1e15;
const ll INF = 0x3f3f3f3f;
const int maxn = 3e5 + 7;
const int mod = 998244353;
#define pi 3.14159265358979323846
ll gcd(ll a,ll b)
{
ll t;
while(b!=0)
{
t=a%b;
a=b;
b=t;
}
return a;
}
ll qPow(ll x, ll k)
{
ll res = 1;
while(k) {
if(k&1)
res=(res*x);
k>>=1;
x=(x*x);
}
return res;
}
ll maxx=-1;
ll minn=inf;
ll num[maxn];
ll num2[maxn];
ll res,ans;
map<string,ll> mp;
priority_queue <int ,vector<int> ,greater<int> > xiaogen;
deque<int> q;
ll a[maxn],b[maxn];
ll wrkc[502][502];
int main()
{
while(T--){
ll sum1=0;
ll sum2=0;
int flag=1;
maxx=0,minn=INF;
int cnt1=0,cnt2=0,cnt3=0;
for(int i=1;i<=n;i++){
sum1+=a[i];
if(a[i]>maxx) maxx=a[i];
if(a[i]){
cnt1++;
if(minn>a[i]) minn=a[i];
}
}
for(int i=1;i<=m;i++){
if(b[i]) cnt2++;
if(b[i]>cnt1) flag=0;
sum2+=b[i];
if(b[i]==n) cnt3++;
}
if(sum1!=sum2) flag=0;
if(cnt3>minn) flag=0;
if(maxx>cnt2) flag=0;
if(flag) printf("Yes\n");
else printf("No\n");
}
return 0;
}
/**
3
1 2
2
1 1

2 2
1 1
1 2

5 2
2 1 1 1 0
0 5
**/

/**************************************************************
Problem: 15362
Language: C++
Result: 正确
Time:2 ms
Memory:13380 kb
****************************************************************/


## 魔法阵

Kiwi会选择三个村的村民各一个，每个村民会从自己拥有的水果中任意选择应有的数量个（苹果3个，梨子2个，香蕉1个）放入魔法阵中
Kiwi认为每个水果都是不同的，两个魔法阵不同当且仅当放入的水果至少有一个不同

Kiwi想知道魔法阵一共可能有多少种，对998244353取模

1 2 1
3
2 3
1


4


Kiwi只能选择仅有的苹果村村民和香蕉村村民，而他们也只能拿出全部的水果

a[i]>=3,b[i]>=2,c[i]>=1

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define HEAP(...) priority_queue<__VA_ARGS__ >
#define heap(...) priority_queue<__VA_ARGS__,vector<__VA_ARGS__ >,greater<__VA_ARGS__ > >
template<class T> inline T min(T &x,const T &y){return x>y?y:x;}
template<class T> inline T max(T &x,const T &y){return x<y?y:x;}
ll read(){ll c = getchar(),Nig = 1,x = 0;while(!isdigit(c) && c!='-')c = getchar();
if(c == '-')Nig = -1,c = getchar();
while(isdigit(c))x = ((x<<1) + (x<<3)) + (c^'0'),c = getchar();
return Nig*x;}
const ll inf = 1e15;
const ll INF = 0x3f3f3f3f;
const int maxn = 3e5 + 7;
const int mod = 998244353;
#define pi 3.14159265358979323846
ll gcd(ll a,ll b)
{
ll t;
while(b!=0)
{
t=a%b;
a=b;
b=t;
}
return a;
}
ll qPow(ll x, ll k)
{
ll res = 1;
while(k) {
if(k&1)
res=(res*x);
k>>=1;
x=(x*x);
}
return res;
}
ll maxx=-1;
ll minn=inf;
ll num[maxn];
///ll a[maxn];
ll num2[maxn];
ll res,ans;
map<string,ll> mp;
priority_queue <int ,vector<int> ,greater<int> > xiaogen;
deque<int> q;
ll a[maxn],b[maxn],c[maxn];
ll wrkc[502][502];
int main()
{
for(int i=0;i<=501;i++){
wrkc[i][i]=1;
wrkc[i][0]=1;
}
for(int i=1;i<=501;i++){
for(int j=1;j<i;j++){
wrkc[i][j]=(wrkc[i-1][j]%mod+wrkc[i-1][j-1]%mod)%mod;
}
}
///cout<<wrkc[6][2]<<endl;
ans=1;
ll temp1=0,temp2=0,temp3=0;
for(int i=1;i<=aa;i++){
temp1+=wrkc[a[i]][3]%mod;
temp1%=mod;
}
for(int i=1;i<=bb;i++){
temp2+=wrkc[b[i]][2]%mod;
temp2%=mod;
}
for(int i=1;i<=cc;i++){
temp3+=c[i]%mod;
temp3%=mod;
}
ans=(temp1%mod)*(temp2%mod)%mod*temp3%mod;
cout<<ans%mod<<endl;
return 0;
}
/**
1 2 1
3
2 3
1
**/

/**************************************************************
Problem: 15364
Language: C++
Result: 正确
Time:27 ms
Memory:15724 kb
****************************************************************/


05-17 353

06-23 142

04-06 124

04-28 115

11-03 16

05-21 91

06-24 150

03-17 32

05-23 73

06-03 32

#### UPC（混合31补题）问题 D: 自习课

©️2020 CSDN 皮肤主题: 深蓝海洋 设计师: CSDN官方博客

1.余额是钱包充值的虚拟货币，按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载，可以购买VIP、C币套餐、付费专栏及课程。