QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#207153#5749. Directed Vertex CactiAlienCollapsarAC ✓9ms3588kbC++145.3kb2023-10-08 10:28:372023-10-08 10:28:37

Judging History

你现在查看的是最新测评结果

  • [2023-10-08 10:28:37]
  • 评测
  • 测评结果:AC
  • 用时:9ms
  • 内存:3588kb
  • [2023-10-08 10:28:37]
  • 提交

answer

#include<cstdio>
#include<iostream>

#ifndef SIMPLER_MODINT 
#define SIMPLER_MODINT 1

#include<cassert>
#include<cstdint>
#include<iostream>

namespace simpler{
	template<const uint32_t _Modulo_Number=UINT32_MAX>
	class modint{
	protected:
		typedef modint<_Modulo_Number> _mint;
		typedef int64_t		_value_type;
		typedef uint32_t	_modulo_type;
		             _value_type  _val;
		static const _value_type  _mod=_Modulo_Number;
		inline friend _mint 
		_construct(_mint &&res,const _value_type  &_construct_number){
			res._val=_construct_number;return res;
		}
		inline friend _mint
		_construct(_mint &&res,      _value_type &&_construct_number){
			res._val=_construct_number;return res;
		}
	public:
		modint():_val(0){}
		template<class _Tp>
		modint(const _Tp  &_number):_val(((_value_type)_number%_mod+_mod)%_mod){}
		modint(const _mint  &_another):_val(_another._val){}
		inline _value_type
		value()const{
			return _val;
		}
		/*
		inline friend _mint
		operator+(const _mint &_first_number,const _mint &_second_number){
			return _first_number._val+_second_number._val>=_mod?
					_construct(_mint(),_first_number._val+_second_number._val-_mod):
					_construct(_mint(),_first_number._val+_second_number._val);
		}
		inline friend _mint
		operator-(const _mint &_first_number,const _mint &_second_number){
			return _first_number._val-_second_number._val<0?
					_construct(_mint(),_first_number._val-_second_number._val+_mod):
					_construct(_mint(),_first_number._val-_second_number._val);
		}
		*/
		inline friend _mint
		operator+(_mint _first_number,const _mint &_second_number){
			return _first_number+=_second_number;
		}
		inline friend _mint
		operator-(_mint _first_number,const _mint &_second_number){
			return _first_number-=_second_number;
		}
		inline _mint &
		operator+=(const _mint &_second_number){
			_val+=_second_number._val;if(_val>=_mod)_val-=_mod;
			return *this;
		}
		inline _mint &
		operator-=(const _mint &_second_number){
			_val-=_second_number._val;if(_val< 0   )_val+=_mod;
			return *this;
		}
		inline _mint &
		operator++(){
			return ++_val==_mod?_val=0:_val;
		}
		inline _mint &
		operator--(){
			return --_val==-1?_val=_mod-1:_val;
		}
		inline _mint
		operator++(int){
			_mint _res(*this);++_val==_mod?_val=0:_val;
			return _res;
		}
		inline _mint
		operator--(int){
			_mint _res(*this);--_val==-1?_val=_mod-1:_val;
			return _res;
		}
		// inline friend _mint
		// operator*(const _mint &_first_number,const _mint &_second_number){
		// 	return _construct(_mint(),_first_number._val*_second_number._val%_mod);
		// }
		inline friend _mint 
		operator*(_mint _first_number,const _mint &_second_number){
			return _first_number*=_second_number;
		}
		inline _mint &
		operator*=(const _mint &_second_number){
			(_val*=_second_number._val)%=_mod;
			return *this;
		}
		inline _mint 
		operator-()const{
			return _construct(_mint(),_val?_mod-_val:_val);
		}
		inline bool
		operator!()const{
			return !_val;
		}
		inline friend _mint 
		operator!=(const _mint &_first_number,const _mint &_second_number){
			return _first_number._val!=_second_number._val;
		}
		inline friend _mint
		operator==(const _mint &_first_number,const _mint &_second_number){
			return _first_number._val==_second_number._val;
		}
		inline friend _mint 
		operator< (const _mint &_first_number,const _mint &_second_number){
			return _first_number._val< _second_number._val;
		}
		inline friend _mint 
		operator<=(const _mint &_first_number,const _mint &_second_number){
			return _first_number._val<=_second_number._val;
		}
		inline friend _mint 
		operator> (const _mint &_first_number,const _mint &_second_number){
			return _first_number._val> _second_number._val;
		}
		inline friend _mint 
		operator>=(const _mint &_first_number,const _mint &_second_number){
			return _first_number._val>=_second_number._val;
		}
		inline friend std::istream &
		operator>>(std::istream &_is,      _mint &_input){
			_is>>_input._val;_input._val%=_mod;
			return _is;
		}
		inline friend std::ostream &
		operator<<(std::ostream &_os,const _mint &_output){
			return _os<<_output._val;
		}
		template<class _Tp>
		friend _mint 
		quickly_power(_mint _base,_Tp _exponential){
			assert(_exponential>=0);
			_mint _res=1;
			for(;_exponential;_exponential>>=1,_base*=_base)
				if(_exponential&1)_res*=_base;
			return _res;
		}
		template<class _Tp>
		inline _mint 
		power(const _Tp &_exponential)const{
			return quickly_power(*this,_exponential);
		}
		template<class _Tp>
		inline _mint &
		selfpower(const _Tp &_exponential){
			return *this=quickly_power(*this,_exponential);
		}
		inline _mint inv()const{
			return quickly_power(*this,_mod-2);
		}
		inline friend _mint 
		operator/(const _mint &_first_number,const _mint &_second_number){
			return _construct(_mint(),_first_number._val*_second_number.inv()._val%_mod);
		}
		inline _mint &
		operator/=(const _mint &_second_number){
			(_val*=_second_number.inv()._val)%=_mod;
			return *this;
		}
	};
}

#endif

using namespace std;
using mint=simpler::modint<(int)1e9+9>;
int main(){
	int n,m;cin>>n>>m;
	mint a=1,b=1,c=1ll*n*(n-1)>>1;
	for(int i=1;i<=n;++i)a*=i;
	for(int i=1;i<=m;++i)b*=i,a*=c-m+i;
	cout<<a/b<<'\n';
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3420kb

input:

3 1

output:

18

result:

ok 1 number(s): "18"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3348kb

input:

4 4

output:

360

result:

ok 1 number(s): "360"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3420kb

input:

39847 348708

output:

983575456

result:

ok 1 number(s): "983575456"

Test #4:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

1 1

output:

0

result:

ok 1 number(s): "0"

Test #5:

score: 0
Accepted
time: 0ms
memory: 3380kb

input:

3 2

output:

18

result:

ok 1 number(s): "18"

Test #6:

score: 0
Accepted
time: 0ms
memory: 3420kb

input:

3 3

output:

6

result:

ok 1 number(s): "6"

Test #7:

score: 0
Accepted
time: 1ms
memory: 3416kb

input:

3 4

output:

0

result:

ok 1 number(s): "0"

Test #8:

score: 0
Accepted
time: 5ms
memory: 3540kb

input:

3 1000000

output:

0

result:

ok 1 number(s): "0"

Test #9:

score: 0
Accepted
time: 0ms
memory: 3292kb

input:

4 1

output:

144

result:

ok 1 number(s): "144"

Test #10:

score: 0
Accepted
time: 0ms
memory: 3420kb

input:

4 2

output:

360

result:

ok 1 number(s): "360"

Test #11:

score: 0
Accepted
time: 0ms
memory: 3416kb

input:

4 3

output:

480

result:

ok 1 number(s): "480"

Test #12:

score: 0
Accepted
time: 0ms
memory: 3344kb

input:

4 5

output:

144

result:

ok 1 number(s): "144"

Test #13:

score: 0
Accepted
time: 0ms
memory: 3372kb

input:

4 6

output:

24

result:

ok 1 number(s): "24"

Test #14:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

5 1

output:

1200

result:

ok 1 number(s): "1200"

Test #15:

score: 0
Accepted
time: 1ms
memory: 3428kb

input:

5 2

output:

5400

result:

ok 1 number(s): "5400"

Test #16:

score: 0
Accepted
time: 0ms
memory: 3408kb

input:

5 3

output:

14400

result:

ok 1 number(s): "14400"

Test #17:

score: 0
Accepted
time: 0ms
memory: 3416kb

input:

5 4

output:

25200

result:

ok 1 number(s): "25200"

Test #18:

score: 0
Accepted
time: 1ms
memory: 3412kb

input:

5 5

output:

30240

result:

ok 1 number(s): "30240"

Test #19:

score: 0
Accepted
time: 0ms
memory: 3400kb

input:

5 6

output:

25200

result:

ok 1 number(s): "25200"

Test #20:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

5 7

output:

14400

result:

ok 1 number(s): "14400"

Test #21:

score: 0
Accepted
time: 0ms
memory: 3424kb

input:

5 8

output:

5400

result:

ok 1 number(s): "5400"

Test #22:

score: 0
Accepted
time: 0ms
memory: 3368kb

input:

5 9

output:

1200

result:

ok 1 number(s): "1200"

Test #23:

score: 0
Accepted
time: 0ms
memory: 3408kb

input:

5 10

output:

120

result:

ok 1 number(s): "120"

Test #24:

score: 0
Accepted
time: 1ms
memory: 3380kb

input:

1000 1

output:

533396879

result:

ok 1 number(s): "533396879"

Test #25:

score: 0
Accepted
time: 0ms
memory: 3380kb

input:

1000 100

output:

199484478

result:

ok 1 number(s): "199484478"

Test #26:

score: 0
Accepted
time: 1ms
memory: 3412kb

input:

1000 10000

output:

656650652

result:

ok 1 number(s): "656650652"

Test #27:

score: 0
Accepted
time: 5ms
memory: 3380kb

input:

1000 1000000

output:

0

result:

ok 1 number(s): "0"

Test #28:

score: 0
Accepted
time: 5ms
memory: 3584kb

input:

535164 619302

output:

721871396

result:

ok 1 number(s): "721871396"

Test #29:

score: 0
Accepted
time: 9ms
memory: 3376kb

input:

1000000 1000000

output:

580712335

result:

ok 1 number(s): "580712335"

Test #30:

score: 0
Accepted
time: 3ms
memory: 3384kb

input:

1000000 234534

output:

546630669

result:

ok 1 number(s): "546630669"

Test #31:

score: 0
Accepted
time: 6ms
memory: 3412kb

input:

234523 1000000

output:

127869098

result:

ok 1 number(s): "127869098"

Test #32:

score: 0
Accepted
time: 1ms
memory: 3420kb

input:

44722 10000

output:

0

result:

ok 1 number(s): "0"