我的P8848代码被司马懿改判成RE了,求大佬调
  • 板块灌水区
  • 楼主弓子瑞2011
  • 当前回复10
  • 已保存回复10
  • 发布时间2024/8/1 19:16
  • 上次更新2024/8/1 20:26:36
查看原帖
我的P8848代码被司马懿改判成RE了,求大佬调
537639
弓子瑞2011楼主2024/8/1 19:16

rt

#include<bits/stdc++.h>
using namespace std;
const int mod=998244353;
int n,y,b=0,c=0;
vector<int> a[10001];
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> n;
	for(int i=1;i<=n;i++){
		int x;
		cin >> x;
		if(x==1) b++;
		else c++;
	}
	y=b-c;
	if(y>0){
		for(int i=0;i<=c;i++){
			for(int j=0;j<=y;j++){
				int cnt=0;
				if(i&&j!=y) cnt+=a[i-1][j+1];
				if(j) cnt+=a[i][j-1];
				if(i||j) a[i].push_back(cnt%mod);
				else a[i].push_back(1);
			}
		}
		cout << a[c][y];
	}
	else{
		for(int i=0;i<=1-y;i++){
			for(int j=0;j<=b;j++){
				int cnt=0;
				if(i) cnt+=a[i-1][j];
				if(j) cnt+=a[i][j-1];
				if(i||j) a[i].push_back(cnt%mod);
				else a[i].push_back(1);
			}
		}
		cout << a[1-y][b];
	}
	return 0;
}
2024/8/1 19:16
加载中...