Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
35858 | A21μΘ_wjy | 【S】T2 | C++ | 通过 | 100 | 57 MS | 448 KB | 878 | 2025-01-05 20:45:31 |
#include<bits/stdc++.h> #define int long long #define PII pair<int,int> #define fir first #define sec second using namespace std; const int maxn=6007; const int mod=1e9+7; inline void Add(int &x,int y){x+=y;(x>=mod?x-=mod:x);} inline int add(int x,int y){return (x+y>=mod?x+y-mod:x+y);} int n; PII P[maxn]; int dp[maxn][2]; signed main(){ #ifndef ONLINE_JUDGE freopen("light.in","r",stdin); freopen("light.out","w",stdout); #endif cin>>n; for(int i=1;i<=n;i++)cin>>P[i].fir>>P[i].sec; sort(P+1,P+n+1); for(int i=1;i<=n;i++){ dp[i][0]=dp[i][1]=1; for(int j=i-1;j>=1;j--){ if(P[j].sec<P[i].sec)Add(dp[i][1],dp[j][0]); else Add(dp[j][0],dp[i][1]); } } int ans=mod-n; for(int i=1;i<=n;i++)Add(ans,add(dp[i][1],dp[i][0])); cout<<ans<<endl; return 0; }