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>
#define int long long
#define ull unsigned long long
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
const int mod=1e9+7;
signed main(){
ios_base::sync_with_stdio();
cin.tie(0);cout.tie(0);
int n;
cin>>n;
vector <int> a(n+1),b(n+1),dp(n+1);
for(int i=1;i<=n;i++)cin>>a[i]>>b[i];
dp[0]=1;
for(int i=1;i<=n;i++){
for(int j=0;j<i;j++){
if(a[j]<a[i]){
dp[i]+=dp[j];
dp[i]%=mod;
}
}
}
int ans=0;
for(int i=1;i<=n;i++){
ans+=dp[i];
ans%=mod;
}
cout<<ans<<"\n";
}
/*
3
3 3
5 5
2 2
*/
# | 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... |