Submission #17760441


Source Code Expand

Copy
#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N,K;
const ll mo=998244353;

int dp[3030][3030];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N>>K;
	dp[K][K]=1;
	
	for(i=K;i<N;i++) {
		for(y=1;y<=N;y++) if(dp[i][y]) {
			for(x=1;x<=y&&i+x<=N;x++) {
				dp[i+x][2*x]+=dp[i][y];
				if(dp[i+x][2*x]>=mo) dp[i+x][2*x]-=mo;
			}
		}
	}
	ll ret=0;
	FOR(i,N+1) ret+=dp[N][i];
	cout<<ret%mo<<endl;
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}

Submission Info

Submission Time
Task D - Number of Multisets
User kmjp
Language C++ (GCC 9.2.1)
Score 600
Code Size 1123 Byte
Status AC
Exec Time 1577 ms
Memory 31088 KB

Compile Error

./Main.cpp: In function ‘void solve()’:
./Main.cpp:22:8: warning: unused variable ‘j’ [-Wunused-variable]
   22 |  int i,j,k,l,r,x,y; string s;
      |        ^
./Main.cpp:22:10: warning: unused variable ‘k’ [-Wunused-variable]
   22 |  int i,j,k,l,r,x,y; string s;
      |          ^
./Main.cpp:22:12: warning: unused variable ‘l’ [-Wunused-variable]
   22 |  int i,j,k,l,r,x,y; string s;
      |            ^
./Main.cpp:22:14: warning: unused variable ‘r’ [-Wunused-variable]
   22 |  int i,j,k,l,r,x,y; string s;
      |              ^
./Main.cpp: In function ‘int main(int, char**)’:
./Main.cpp:7:28: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
    7 | #define FOR(x,to) for(x=0;x<(to);x++)
      |                            ^
./Main.cpp:45:38: note: in expansion of macro ‘FOR’
   45 |  FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
      |                                      ^~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 600 / 600
Status
AC × 2
AC × 50
Set Name Test Cases
Sample example_00, example_01
All example_00, example_01, handmade_00, handmade_01, handmade_02, handmade_03, handmade_04, handmade_05, handmade_06, handmade_07, max_random2_00, max_random2_01, max_random2_02, max_random2_03, max_random2_04, max_random2_05, max_random2_06, max_random2_07, max_random2_08, max_random2_09, max_random_00, max_random_01, max_random_02, max_random_03, max_random_04, max_random_05, max_random_06, max_random_07, max_random_08, max_random_09, random_00, random_01, random_02, random_03, random_04, random_05, random_06, random_07, random_08, random_09, small_00, small_01, small_02, small_03, small_04, small_05, small_06, small_07, small_08, small_09
Case Name Status Exec Time Memory
example_00 AC 6 ms 3612 KB
example_01 AC 699 ms 22388 KB
handmade_00 AC 1570 ms 31088 KB
handmade_01 AC 1460 ms 30396 KB
handmade_02 AC 886 ms 25584 KB
handmade_03 AC 2 ms 3544 KB
handmade_04 AC 2 ms 3452 KB
handmade_05 AC 2 ms 3640 KB
handmade_06 AC 1370 ms 29616 KB
handmade_07 AC 7 ms 3460 KB
max_random2_00 AC 1488 ms 30576 KB
max_random2_01 AC 1520 ms 30724 KB
max_random2_02 AC 1555 ms 30936 KB
max_random2_03 AC 1514 ms 30800 KB
max_random2_04 AC 1434 ms 30220 KB
max_random2_05 AC 1544 ms 30908 KB
max_random2_06 AC 1407 ms 30040 KB
max_random2_07 AC 1565 ms 31000 KB
max_random2_08 AC 1507 ms 30668 KB
max_random2_09 AC 1577 ms 31076 KB
max_random_00 AC 4 ms 3724 KB
max_random_01 AC 6 ms 3852 KB
max_random_02 AC 4 ms 3876 KB
max_random_03 AC 4 ms 3684 KB
max_random_04 AC 3 ms 3792 KB
max_random_05 AC 5 ms 3848 KB
max_random_06 AC 4 ms 3620 KB
max_random_07 AC 4 ms 3676 KB
max_random_08 AC 3 ms 3840 KB
max_random_09 AC 4 ms 3888 KB
random_00 AC 16 ms 5652 KB
random_01 AC 6 ms 4272 KB
random_02 AC 8 ms 3888 KB
random_03 AC 11 ms 4800 KB
random_04 AC 467 ms 19444 KB
random_05 AC 12 ms 5128 KB
random_06 AC 33 ms 7296 KB
random_07 AC 13 ms 5616 KB
random_08 AC 218 ms 14264 KB
random_09 AC 3 ms 3844 KB
small_00 AC 2 ms 3604 KB
small_01 AC 4 ms 3692 KB
small_02 AC 5 ms 3964 KB
small_03 AC 2 ms 3724 KB
small_04 AC 3 ms 3584 KB
small_05 AC 3 ms 3788 KB
small_06 AC 3 ms 3644 KB
small_07 AC 3 ms 3664 KB
small_08 AC 3 ms 3676 KB
small_09 AC 3 ms 3808 KB