Submission #48659015


Source Code Expand

// LUOGU_RID: 140223726
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 305;
const int mod = 998244353;
int n,m;
int a,b,c,d,e,f;
map<pair<int,int>,bool> mp;
int ans; 
int dp[N][N][N];
signed main(){
	cin >> n >> m;
	cin >> a >> b >> c >> d >> e >> f;
	for(int i = 1;i <= m;i++){
		int x,y;
		cin >> x >> y;
		mp[{x,y}]=1;
	}
	dp[0][0][0]=1;
	
	for(int i = 0;i <= n;i++){
		for(int j = 0;j <= n;j++){
			for(int k = 0;k <= n;k++){
				if(mp.find({i * a + j * c + k * e,i * b + j * d + k * f}) != mp.end()) continue;
				if(i)dp[i][j][k]+=dp[i-1][j][k];
				if(j)dp[i][j][k]+=dp[i][j-1][k];
				if(k)dp[i][j][k]+=dp[i][j][k-1];
				dp[i][j][k] %= mod;
			}
		}
	}
	
	for(int x=0;x<=n;x++){
		for(int y=0;y<=n-x;y++){
			int z = n-x-y;
			ans = (ans + dp[x][y][z]) % mod;
//			cout<<x<<" "<<y<<" "<<z<<" "<<dp[x][y][z]<<endl;
		}
	}
	
	cout<<ans;
	return 0;
}

Submission Info

Submission Time
Task E - Warp
User Expert_Dream
Language C++ 17 (gcc 12.2)
Score 500
Code Size 933 Byte
Status AC
Exec Time 384 ms
Memory 220780 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 500 / 500
Status
AC × 3
AC × 30
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_27.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
random_01.txt AC 264 ms 220596 KiB
random_02.txt AC 122 ms 123896 KiB
random_03.txt AC 248 ms 220572 KiB
random_04.txt AC 4 ms 6868 KiB
random_05.txt AC 281 ms 220780 KiB
random_06.txt AC 79 ms 68064 KiB
random_07.txt AC 343 ms 220616 KiB
random_08.txt AC 3 ms 6000 KiB
random_09.txt AC 278 ms 220640 KiB
random_10.txt AC 4 ms 7196 KiB
random_11.txt AC 362 ms 220628 KiB
random_12.txt AC 142 ms 122712 KiB
random_13.txt AC 384 ms 220596 KiB
random_14.txt AC 2 ms 4320 KiB
random_15.txt AC 300 ms 220732 KiB
random_16.txt AC 13 ms 17440 KiB
random_17.txt AC 1 ms 3576 KiB
random_18.txt AC 243 ms 220640 KiB
random_19.txt AC 1 ms 3548 KiB
random_20.txt AC 337 ms 220620 KiB
random_21.txt AC 1 ms 3528 KiB
random_22.txt AC 243 ms 220688 KiB
random_23.txt AC 1 ms 3552 KiB
random_24.txt AC 374 ms 220584 KiB
random_25.txt AC 364 ms 220628 KiB
random_26.txt AC 359 ms 220652 KiB
random_27.txt AC 352 ms 220592 KiB
sample_01.txt AC 1 ms 3712 KiB
sample_02.txt AC 1 ms 3852 KiB
sample_03.txt AC 243 ms 220620 KiB