# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
672246 |
2022-12-15T08:16:14 Z |
Dan4Life |
Boat (APIO16_boat) |
C++17 |
|
2000 ms |
524288 KB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define fi first
#define se second
const int maxn = 5e2+10;
const int MOD = (int)1e9+7;
pair<int,int> a[maxn];
unordered_map<int,int> dp[maxn];
int n;
int32_t main() {
cin >> n; int ans = 0;
for(int i = 0; i < n; i++) cin >> a[i].fi >> a[i].se;
for(int i = 0; i < n; i++){
for(int j = a[i].fi; j <= a[i].se; j++){
dp[i][j]=1;
if(j>a[i].fi) dp[i][j]+=dp[i][j-1];
if(dp[i][j]>MOD) dp[i][j]-=MOD;
for(int k = 0; k < i; k++)
if(j>a[k].fi) dp[i][j]+=dp[k][min(j-1,a[k].se)], dp[i][j]%=MOD;
}
}
for(int i = 0; i < n; i++) ans+=dp[i][a[i].se], ans%=MOD;
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
340 KB |
Output is correct |
2 |
Correct |
4 ms |
340 KB |
Output is correct |
3 |
Correct |
4 ms |
340 KB |
Output is correct |
4 |
Correct |
3 ms |
340 KB |
Output is correct |
5 |
Correct |
3 ms |
340 KB |
Output is correct |
6 |
Correct |
5 ms |
340 KB |
Output is correct |
7 |
Correct |
5 ms |
340 KB |
Output is correct |
8 |
Correct |
5 ms |
340 KB |
Output is correct |
9 |
Correct |
5 ms |
340 KB |
Output is correct |
10 |
Correct |
5 ms |
340 KB |
Output is correct |
11 |
Correct |
5 ms |
340 KB |
Output is correct |
12 |
Correct |
5 ms |
340 KB |
Output is correct |
13 |
Correct |
6 ms |
340 KB |
Output is correct |
14 |
Correct |
5 ms |
340 KB |
Output is correct |
15 |
Correct |
6 ms |
340 KB |
Output is correct |
16 |
Correct |
4 ms |
340 KB |
Output is correct |
17 |
Correct |
3 ms |
340 KB |
Output is correct |
18 |
Correct |
4 ms |
340 KB |
Output is correct |
19 |
Correct |
3 ms |
340 KB |
Output is correct |
20 |
Correct |
4 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
340 KB |
Output is correct |
2 |
Correct |
4 ms |
340 KB |
Output is correct |
3 |
Correct |
4 ms |
340 KB |
Output is correct |
4 |
Correct |
3 ms |
340 KB |
Output is correct |
5 |
Correct |
3 ms |
340 KB |
Output is correct |
6 |
Correct |
5 ms |
340 KB |
Output is correct |
7 |
Correct |
5 ms |
340 KB |
Output is correct |
8 |
Correct |
5 ms |
340 KB |
Output is correct |
9 |
Correct |
5 ms |
340 KB |
Output is correct |
10 |
Correct |
5 ms |
340 KB |
Output is correct |
11 |
Correct |
5 ms |
340 KB |
Output is correct |
12 |
Correct |
5 ms |
340 KB |
Output is correct |
13 |
Correct |
6 ms |
340 KB |
Output is correct |
14 |
Correct |
5 ms |
340 KB |
Output is correct |
15 |
Correct |
6 ms |
340 KB |
Output is correct |
16 |
Correct |
4 ms |
340 KB |
Output is correct |
17 |
Correct |
3 ms |
340 KB |
Output is correct |
18 |
Correct |
4 ms |
340 KB |
Output is correct |
19 |
Correct |
3 ms |
340 KB |
Output is correct |
20 |
Correct |
4 ms |
340 KB |
Output is correct |
21 |
Execution timed out |
2094 ms |
23472 KB |
Time limit exceeded |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
950 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
340 KB |
Output is correct |
2 |
Correct |
4 ms |
340 KB |
Output is correct |
3 |
Correct |
4 ms |
340 KB |
Output is correct |
4 |
Correct |
3 ms |
340 KB |
Output is correct |
5 |
Correct |
3 ms |
340 KB |
Output is correct |
6 |
Correct |
5 ms |
340 KB |
Output is correct |
7 |
Correct |
5 ms |
340 KB |
Output is correct |
8 |
Correct |
5 ms |
340 KB |
Output is correct |
9 |
Correct |
5 ms |
340 KB |
Output is correct |
10 |
Correct |
5 ms |
340 KB |
Output is correct |
11 |
Correct |
5 ms |
340 KB |
Output is correct |
12 |
Correct |
5 ms |
340 KB |
Output is correct |
13 |
Correct |
6 ms |
340 KB |
Output is correct |
14 |
Correct |
5 ms |
340 KB |
Output is correct |
15 |
Correct |
6 ms |
340 KB |
Output is correct |
16 |
Correct |
4 ms |
340 KB |
Output is correct |
17 |
Correct |
3 ms |
340 KB |
Output is correct |
18 |
Correct |
4 ms |
340 KB |
Output is correct |
19 |
Correct |
3 ms |
340 KB |
Output is correct |
20 |
Correct |
4 ms |
340 KB |
Output is correct |
21 |
Execution timed out |
2094 ms |
23472 KB |
Time limit exceeded |
22 |
Halted |
0 ms |
0 KB |
- |