답안 #73253

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
73253 2018-08-28T06:00:59 Z maus1208 Asceticism (JOI18_asceticism) C++14
0 / 100
4 ms 504 KB
#import<bits/stdc++.h>
using namespace std;

#define sysp system("pause")
#define mod 1000000007
#define rmod 1000000005

typedef long long ll;

ll n,k,ans;
vector<ll> f,rf;

ll mypow(ll x,ll n){
	ll ret=1;
	while(n>0){
		if((n&1)==1){
			ret*=x%mod;
		}
		x*=x%mod;
		n>>=1;
	}
	return ret%mod;
}

void init(){
	f[0]=1;
	rf[0]=1;
	for(ll i=1;i<=100010;i++){
		f[i]*=i*f[i-1]%mod;
		rf[i]=mypow(f[i],rmod);
	}
}

int main(){
	cin>>n>>k;
	ll tmp=-1;
	init();
	for(ll i=0;i<=k;i++){
		tmp*=-1;
		ans+=f[n+1]*rf[i]*rf[n+1-i]*tmp*mypow((k-i+1),n)%mod;
	}
	cout<<ans<<endl;
}

Compilation message

asceticism.cpp:1:2: warning: #import is a deprecated GCC extension [-Wdeprecated]
 #import<bits/stdc++.h>
  ^~~~~~
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 4 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -