Submission #19014464


Source Code Expand

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

#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 ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
template<class T> bool chmax(T &a, const T &b) { if(a<b){a=b;return 1;}return 0;}
template<class T> bool chmin(T &a, const T &b) { if(a>b){a=b;return 1;}return 0;}
//-------------------------------------------------------

int D;
const ll mo=998244353;
const int NUM_=2400001;
static ll fact[NUM_+1],factr[NUM_+1],inv[NUM_+1];

ll comb(ll N_, ll C_) {
	if (fact[0]==0) {
		inv[1]=fact[0]=factr[0]=1;
		for (int i=2;i<=NUM_;++i) inv[i] = inv[mo % i] * (mo - mo / i) % mo;
		for (int i=1;i<=NUM_;++i) fact[i]=fact[i-1]*i%mo, factr[i]=factr[i-1]*inv[i]%mo;
	}
	if(C_<0 || C_>N_) return 0;
	return factr[C_]*fact[N_]%mo*factr[N_-C_]%mo;
}


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>D;
	ll ret=0;
	for(i=0;i<D;i++) ret+=comb(D-1+i,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 A - Dodecagon
User kmjp
Language C++ (GCC 9.2.1)
Score 500
Code Size 1393 Byte
Status AC
Exec Time 117 ms
Memory 59904 KB

Compile Error

./Main.cpp: In function ‘void solve()’:
./Main.cpp:33:8: warning: unused variable ‘j’ [-Wunused-variable]
   33 |  int i,j,k,l,r,x,y; string s;
      |        ^
./Main.cpp:33:10: warning: unused variable ‘k’ [-Wunused-variable]
   33 |  int i,j,k,l,r,x,y; string s;
      |          ^
./Main.cpp:33:12: warning: unused variable ‘l’ [-Wunused-variable]
   33 |  int i,j,k,l,r,x,y; string s;
      |            ^
./Main.cpp:33:14: warning: unused variable ‘r’ [-Wunused-variable]
   33 |  int i,j,k,l,r,x,y; string s;
      |              ^
./Main.cpp:33:16: warning: unused variable ‘x’ [-Wunused-variable]
   33 |  int i,j,k,l,r,x,y; string s;
      |                ^
./Main.cpp:33:18: warning: unused variable ‘y’ [-Wunused-variable]
   33 |  int i,j,k,l,r,x,y; string s;
      |                  ^
./Main.cpp: In function ‘int main(int, char**)’:
./Main.cpp:6:28: warning: comparison of integer expressions of different signedness: ‘int’ and ‘std::__cxx11::basic_string<char>::size_type’ {aka ‘long unsigned int’} [-Wsign-compare]
    6 | #define FOR(x,to) for(x=0;x<(to);x++)
      |                            ^
./Main.cpp:46:38: note: in expansion of macro ‘FOR’
   46 |  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 500 / 500
Status
AC × 1
AC × 12
Set Name Test Cases
Sample example0.txt
All 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, example0.txt
Case Name Status Exec Time Memory
000.txt AC 116 ms 59904 KB
001.txt AC 113 ms 59764 KB
002.txt AC 110 ms 59756 KB
003.txt AC 117 ms 59864 KB
004.txt AC 114 ms 59812 KB
005.txt AC 112 ms 59828 KB
006.txt AC 111 ms 59760 KB
007.txt AC 112 ms 59904 KB
008.txt AC 117 ms 59852 KB
009.txt AC 115 ms 59820 KB
010.txt AC 112 ms 59860 KB
example0.txt AC 113 ms 59740 KB