답안 #234525

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
234525 2020-05-24T11:48:17 Z shayan_p Ljetopica (COI19_ljetopica) C++14
0 / 100
7 ms 1152 KB
// Never let them see you bleed...

#include<bits/stdc++.h>

#define F first
#define S second
#define PB push_back
#define sz(s) int((s).size())
#define bit(n,k) (((n)>>(k))&1)

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

const int maxn = 1e5 + 10, mod = 1e9 + 7, inf = 1e9 + 10;

int fac[maxn], ifac[maxn];

int Pow(int a, int b){
    int ans = 1;
    for(; b; b>>=1, a = 1ll * a * a % mod)
	if(b & 1)
	    ans = 1ll * ans * a % mod;
    return ans;
}
int C(int n, int k){
    if(n < 0 || k < 0 || n < k)
	return 0;
    return 1ll * fac[n] * ifac[k] %mod * ifac[n-k] % mod;
}

int main(){
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie();

    fac[0] = 1;
    for(int i = 1; i < maxn; i++)
	fac[i] = 1ll * i * fac[i-1] % mod;
    ifac[maxn-1] = Pow(fac[maxn-1], mod-2);
    for(int i = maxn-2; i >= 0; i--)
	ifac[i] = 1ll * ifac[i+1] * (i+1) % mod;
    
    int n, k;
    cin >> n >> k;
    string s, A, B;
    cin >> s >> A >> B;

    int num = 1;
    for(int i = 0; i < n; i++)
	num = 2ll * num % mod;
    int tw = 1ll * num * ifac[2] % mod;    
    num--;
    return cout << 1ll * C(n, k) * (num + tw) % mod << "\n", 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 1152 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 1152 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 7 ms 1152 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 1152 KB Output isn't correct
2 Halted 0 ms 0 KB -