This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,m;
ll a[2005],b[2005];
ll pref[2005],suff[2005];
ll mod=1e9+7;
ll jawab;
vector <ll> ans;
ll fact (ll n){
if (n==0) return 1;
return n%mod*fact(n-1)%mod;
}
ll kali (ll a, ll b){
return (a*b)%mod;
}
ll simpan=1;
void fexpo(ll a, ll b){
// cout<<a<<" "<<b<<endl;
if (b==1) {
simpan=kali(simpan,a);
return;
}
if (b%2==0){
fexpo(kali(a,a),b/2);
}
else{
simpan=kali(simpan,a);
fexpo(kali(a,a),(b-1)/2);
}
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin>>n>>m;
for (int i=1;i<=n;i++){
cin>>a[i];
pref[i]=max(pref[i-1],a[i]);
// cout<<pref[i]<<endl;
}
for (int i=1;i<=n;i++){
suff[i]=max(suff[i-1],a[n-i+1]);
}
// for (int i=1;i<=n;i++) cout<<pref[i]<<" "<<suff[i]<<":::"<<i<<endl;
for (int i=1;i<=m;i++){
cin>>b[i];
}
if (n<m) {
cout<<0;
return 0;
}
// ll tes=1;
// ll u=m-1;
// fexpo(fact(u)%mod,mod-2);
// tes*=simpan%mod;
// simpan=1;
// fexpo(fact(n-m-2)%mod,mod-2);
// tes*=simpan%mod*fact(n-1)%mod;
// tes%=mod;
// cout<<tes;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |