#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;
typedef vector<ii> vii;
typedef long double lld;
#define rep(i,a,b) for(ll i = a; i < b; i++)
#define per(i,a,b) for(ll i = a; i >= b; i--)
#define inf 1000000000000000000
#define all(x) x.begin(),x.end()
#define sz(x) (ll)(x).size()
#define trav(a,x) for(auto a : x)
const ll mod = 1000000007;
ll n;
vi a,b,s;
int main(){
cin >> n;
a.assign(n,0); b.assign(n,0);
rep(i,0,n) {
cin >> a[i] >> b[i];
assert(b[i]-a[i] < 1000010);
per(j,b[i],a[i]) { s.push_back(j); }
}
vi dp; dp.assign(sz(s),0);
rep(i,0,sz(s)){
dp[i] = 1;
rep(j,0,i) if (s[j] < s[i]) dp[i] = (dp[i]+dp[j])%mod;
}
ll res = 0;
rep(i,0,sz(s)) res += dp[i];
cout << res << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
248 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
248 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
3 ms |
488 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
248 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |