#include<bits/stdc++.h>
#define I inline void
using ll = long long ;
using ld = long double ;
using namespace std ;
const int N = 1e4 + 7 , mod = 1e9 + 7 ;
// how interesting!
int n;
ll dp[N] ;
ll ans = 0 ;
int main(){
ios_base::sync_with_stdio(0) ;
cin.tie(0) ;
//freopen("in.in" , "r" , stdin) ;
cin >> n ;
dp[0] = 1ll ;
for(int i = 0 ;i < n ; i++){
ll x , y ;
cin >> x >> y ;
map<ll , ll> mp ;
for(int j = x ;j <= y ;j ++){
for(int k = 0 ; k < j ; k++){
mp[j] += dp[k] ;
mp[j]%=mod ;
}
}
for(auto u : mp){
dp[u.first]+=u.second ;
dp[u.first]%= mod ;
}
}
for(int i = 0 ;i < N ;i++){
ans = (ans + dp[i]) %mod ;
}
cout<< (mod + ans - 1 ) %mod ;
return 0 ;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
512 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1 ms |
512 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |