Submission #60166594


Source Code Expand

#include<bits/stdc++.h>
#include"atcoder/all"
using namespace std;
using namespace atcoder;
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(a) a.begin(),a.end()
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> P;
const ll mod=998244353;
const ll inf=1ll<<61;
typedef modint998244353 mi;

mi kj[600005];

mi binom(int r,int c){
	if(r<c)return 0;
	return kj[r]/kj[c]/kj[r-c];
}

int main(){
	kj[0]=1;
	for(int i=1;i<=600000;i++)kj[i]=kj[i-1]*i;

	int R,G,B,K,X,Y,Z;
	cin>>R>>G>>B>>K>>X>>Y>>Z;

	vector<mi>r(R+1),b(B+1);
	rep(i,R+1){
		if(K-Y<=i)r[i]=binom(R,i);
		else r[i]=0;
	}
	rep(i,B+1){
		if(K-X<=i)b[i]=binom(B,i);
		else b[i]=0;
	}
	vector<mi>rb=convolution(r,b);
	for(int i=Z+1;i<rb.size();i++)rb[i]=0;
	vector<mi>g(G+1);
	rep(i,G+1){
		g[i]=binom(G,i);
	}
	vector<mi>rgb=convolution(rb,g);
	cout<<rgb[K].val()<<endl;
}

Submission Info

Submission Time
Task 065 - RGB Balls 2(★7)
User Rho17
Language C++ 20 (gcc 12.2)
Score 7
Code Size 890 Byte
Status AC
Exec Time 203 ms
Memory 20384 KiB

Compile Error

Main.cpp: In function ‘int main()’:
Main.cpp:38:24: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::vector<atcoder::static_modint<998244353> >::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
   38 |         for(int i=Z+1;i<rb.size();i++)rb[i]=0;
      |                       ~^~~~~~~~~~

Judge Result

Set Name Sample Subtask1 Subtask2 All
Score / Max Score 0 / 0 3 / 3 2 / 2 2 / 2
Status
AC × 3
AC × 16
AC × 12
AC × 51
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
Subtask1 10_random_small_00.txt, 10_random_small_01.txt, 10_random_small_02.txt, 10_random_small_03.txt, 10_random_small_04.txt, 10_random_small_05.txt, 10_random_small_06.txt, 10_random_small_07.txt, 80_hand_small_00.txt, 90_zero_small_00.txt, 90_zero_small_01.txt, 90_zero_small_02.txt, 90_zero_small_03.txt, 90_zero_small_04.txt, 90_zero_small_05.txt, 90_zero_small_06.txt
Subtask2 11_random_medium_00.txt, 11_random_medium_01.txt, 11_random_medium_02.txt, 11_random_medium_03.txt, 11_random_medium_04.txt, 11_random_medium_05.txt, 11_random_medium_06.txt, 11_random_medium_07.txt, 91_zero_medium_00.txt, 91_zero_medium_01.txt, 91_zero_medium_02.txt, 91_zero_medium_03.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 10_random_small_00.txt, 10_random_small_01.txt, 10_random_small_02.txt, 10_random_small_03.txt, 10_random_small_04.txt, 10_random_small_05.txt, 10_random_small_06.txt, 10_random_small_07.txt, 11_random_medium_00.txt, 11_random_medium_01.txt, 11_random_medium_02.txt, 11_random_medium_03.txt, 11_random_medium_04.txt, 11_random_medium_05.txt, 11_random_medium_06.txt, 11_random_medium_07.txt, 12_random_large_00.txt, 12_random_large_01.txt, 12_random_large_02.txt, 12_random_large_03.txt, 12_random_large_04.txt, 12_random_large_05.txt, 12_random_large_06.txt, 12_random_large_07.txt, 13_random_max_00.txt, 13_random_max_01.txt, 13_random_max_02.txt, 13_random_max_03.txt, 13_random_max_04.txt, 13_random_max_05.txt, 13_random_max_06.txt, 13_random_max_07.txt, 80_hand_small_00.txt, 83_hand_max_00.txt, 90_zero_small_00.txt, 90_zero_small_01.txt, 90_zero_small_02.txt, 90_zero_small_03.txt, 90_zero_small_04.txt, 90_zero_small_05.txt, 90_zero_small_06.txt, 91_zero_medium_00.txt, 91_zero_medium_01.txt, 91_zero_medium_02.txt, 91_zero_medium_03.txt, 92_zero_large_00.txt, 92_zero_large_01.txt, 92_zero_large_02.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 4 ms 5908 KiB
00_sample_01.txt AC 4 ms 5828 KiB
00_sample_02.txt AC 49 ms 9264 KiB
10_random_small_00.txt AC 4 ms 5844 KiB
10_random_small_01.txt AC 4 ms 5864 KiB
10_random_small_02.txt AC 4 ms 6032 KiB
10_random_small_03.txt AC 4 ms 5752 KiB
10_random_small_04.txt AC 4 ms 5848 KiB
10_random_small_05.txt AC 4 ms 6028 KiB
10_random_small_06.txt AC 4 ms 5844 KiB
10_random_small_07.txt AC 4 ms 6028 KiB
11_random_medium_00.txt AC 6 ms 5884 KiB
11_random_medium_01.txt AC 6 ms 5992 KiB
11_random_medium_02.txt AC 5 ms 5900 KiB
11_random_medium_03.txt AC 6 ms 6032 KiB
11_random_medium_04.txt AC 5 ms 5924 KiB
11_random_medium_05.txt AC 5 ms 6032 KiB
11_random_medium_06.txt AC 6 ms 5908 KiB
11_random_medium_07.txt AC 5 ms 5940 KiB
12_random_large_00.txt AC 59 ms 9640 KiB
12_random_large_01.txt AC 115 ms 13516 KiB
12_random_large_02.txt AC 115 ms 13228 KiB
12_random_large_03.txt AC 138 ms 13976 KiB
12_random_large_04.txt AC 96 ms 12812 KiB
12_random_large_05.txt AC 58 ms 9840 KiB
12_random_large_06.txt AC 100 ms 12764 KiB
12_random_large_07.txt AC 98 ms 13148 KiB
13_random_max_00.txt AC 196 ms 20332 KiB
13_random_max_01.txt AC 202 ms 20384 KiB
13_random_max_02.txt AC 203 ms 20348 KiB
13_random_max_03.txt AC 201 ms 20268 KiB
13_random_max_04.txt AC 194 ms 20340 KiB
13_random_max_05.txt AC 198 ms 20256 KiB
13_random_max_06.txt AC 200 ms 20256 KiB
13_random_max_07.txt AC 198 ms 20264 KiB
80_hand_small_00.txt AC 4 ms 5748 KiB
83_hand_max_00.txt AC 203 ms 20280 KiB
90_zero_small_00.txt AC 4 ms 5872 KiB
90_zero_small_01.txt AC 4 ms 5944 KiB
90_zero_small_02.txt AC 4 ms 5752 KiB
90_zero_small_03.txt AC 4 ms 5952 KiB
90_zero_small_04.txt AC 4 ms 5848 KiB
90_zero_small_05.txt AC 4 ms 5848 KiB
90_zero_small_06.txt AC 4 ms 5880 KiB
91_zero_medium_00.txt AC 5 ms 6008 KiB
91_zero_medium_01.txt AC 6 ms 6036 KiB
91_zero_medium_02.txt AC 6 ms 6112 KiB
91_zero_medium_03.txt AC 7 ms 6000 KiB
92_zero_large_00.txt AC 83 ms 12976 KiB
92_zero_large_01.txt AC 163 ms 20288 KiB
92_zero_large_02.txt AC 121 ms 20340 KiB