Submission #851887

#TimeUsernameProblemLanguageResultExecution timeMemory
851887vjudge1Magneti (COCI21_magneti)C++17
0 / 110
1 ms604 KiB
#pragma GCC optimize("unroll-loops,Ofast,O3") #include <bits/stdc++.h> #define pb push_back #define mp make_pair #define spc << " " << #define endl "\n" #define all(x) x.begin(), x.end() #define ll long long #define int long long #define ii pair<int,int> #define vi vector<int> #define vii vector<ii> #define st first #define nd second #define inf 1000000009 #define MOD 1000000007 using namespace std; int fact[20005]; int mult(int x, int y){ return ((x%MOD)*(y%MOD))%MOD; } void init(){ fact[0]=1; for(int i=1; i<=20003; i++) fact[i] = mult(fact[i-1], i); } int add(int x, int y){ if(x+y>=MOD) return x+y-MOD; return x+y; } int fst(int base, int p){ int res=1; while(p>0){ if(p%2){ res*=base; res%=MOD; p--; } base*=base; base%=MOD; p/=2; } return res; } int divi(int x, int y){ y = fst(y, MOD-2); return mult(x, y); } void solve(){ init(); int n,l; cin >> n >> l; int r; for(int i=1; i<=n; i++) cin >> r; int k = (l-(1+((n-1)*r))); cerr << k << endl; int ans = divi(fact[add(n, k)], fact[k]); cout << ans << endl; } signed main(){ ios_base::sync_with_stdio(false);cin.tie(0); #ifdef Local freopen("in","r",stdin); freopen("out","w",stdout); #endif ll t=1; //cin >> t; while(t--) solve(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...