Submission #1110152

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
11101522024-11-08 20:59:23vjudge1Žarulje (COI15_zarulje)C++17
100 / 100
356 ms191816 KiB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define Ls l.top()
#define Rs r.top()
#define calc(x) (fac[mp1[x]+mp2[x]]*inv[mp2[x]]%M*inv[mp1[x]]%M)
const int M=1e9+7,N=1<<18;
int H[N],fac[N],inv[N],res[N],mp1[N],mp2[N];
stack<int>bad[N],l,r;
int qp(int x,int k=M-2){
if(!k) return 1;
int y=qp(x,k/2);
y=y*y%M;
if(k&1)y=y*x%M;
return y;
}
signed main(){
l.push(0),r.push(0);
cin.tie(0)->sync_with_stdio(0);
fac[0]=1;
for(int i=1;i<N;i++)
fac[i]=fac[i-1]*i%M;
inv[N-1]=qp(fac[N-1]);
res[1]=1;
for(int i=N;--i;)
inv[i-1]=inv[i]*i%M;
int n,k;
cin>>n>>k;
for(int i=1;i<=n;i++)
cin>>H[i];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...