#include <bits/stdc++.h>
using namespace std; long long int mod=1e9+7;
pair <long long int, long long int> l [1000];
long long int dp [2][1000010];
int main(){
int n; cin >> n;
for (int i=0; i<n; i++){
int a,b; cin >> a >> b;
l [i].first=a; l[i].second=b;
}
dp [0][0]=1;
for (int j=1; j<1000010; j++) dp [0][j]+=dp [0][j-1];
for (int i=0; i<n; i++){
for (int j=l [i].first; j<=l [i].second; j++){
dp [1][j]=(dp [1][j]+dp [0][j-1])%mod;
//cout << dp [1][j] << endl;
}
dp [1][0]=(dp [1][0]+dp [0][1000009])%mod;
for (int j=1; j<1000010; j++){
//cout << dp [1][j] << " ";
dp[1][j]=(dp [1][j]+dp [1][j-1])%mod;
//cout << dp [1][j] << endl;
}
//cout << endl;
swap (dp [0], dp [1]);
for (int j=0; j<1000010; j++) dp [1][j]=0;
}
cout << (dp [0][1000009]-1)%mod << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
16 ms |
16212 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
16 ms |
16212 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
12 ms |
16212 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
16 ms |
16212 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |