Submission #234526

# Submission time Handle Problem Language Result Execution time Memory
234526 2020-05-24T11:49:47 Z shayan_p Ljetopica (COI19_ljetopica) C++14
17 / 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-1, k) * (num + tw) % mod << "\n", 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 1152 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 1152 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 1152 KB Output is correct
2 Correct 6 ms 1152 KB Output is correct
3 Correct 7 ms 1152 KB Output is correct
4 Correct 6 ms 1152 KB Output is correct
5 Correct 6 ms 1152 KB Output is correct
6 Correct 6 ms 1152 KB Output is correct
7 Correct 6 ms 1152 KB Output is correct
8 Correct 6 ms 1152 KB Output is correct
9 Correct 6 ms 1152 KB Output is correct
10 Correct 7 ms 1152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 6 ms 1152 KB Output isn't correct
2 Halted 0 ms 0 KB -