# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
735349 |
2023-05-04T03:17:28 Z |
bin9638 |
Boat (APIO16_boat) |
C++17 |
|
2000 ms |
524288 KB |
#include <bits/stdc++.h>
using namespace std;
#define N 510
#define ll long long
#define fs first
#define sc second
#define ii pair<ll,int>
#define pb push_back
#define int ll
const ll mod=1e9+7;
void selfadd(int&u,int v)
{
u=(u+v)%mod;
}
int n,l[N],r[N];
vector<int>dp[N];
int32_t main()
{
#ifdef SKY
freopen("A.inp","r",stdin);
freopen("A.out","w",stdout);
#endif // SKY
ios::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>l[i]>>r[i];
dp[i].resize(r[i]-l[i]+1,0);
}
for(int i=1;i<=n;i++)
for(int j=l[i];j<=r[i];j++)
{
dp[i][j-l[i]]=1;
if(j>l[i])
dp[i][j-l[i]]=dp[i][j-l[i]-1]+1;
// cout<<i<<" "<<j<<" "<<dp[i][j-l[i]]<<endl;
for(int k=1;k<i;k++)
{
if(j>r[k])
{
selfadd(dp[i][j-l[i]],dp[k].back());
continue;
}
if(j<=l[k])
continue;
selfadd(dp[i][j-l[i]],dp[k][j-l[k]-1]);
}
// cout<<i<<" "<<j<<" "<<dp[i][j-l[i]]<<endl;
}
int res=0;
for(int i=1;i<=n;i++)
selfadd(res,dp[i].back());
cout<<(res+mod*mod)%mod;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
2 ms |
340 KB |
Output is correct |
11 |
Correct |
2 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
2 ms |
340 KB |
Output is correct |
14 |
Correct |
2 ms |
340 KB |
Output is correct |
15 |
Correct |
2 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
1 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
2 ms |
340 KB |
Output is correct |
11 |
Correct |
2 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
2 ms |
340 KB |
Output is correct |
14 |
Correct |
2 ms |
340 KB |
Output is correct |
15 |
Correct |
2 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
1 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Correct |
1127 ms |
7192 KB |
Output is correct |
22 |
Correct |
1092 ms |
7128 KB |
Output is correct |
23 |
Correct |
1012 ms |
6740 KB |
Output is correct |
24 |
Correct |
1132 ms |
7500 KB |
Output is correct |
25 |
Correct |
1104 ms |
7464 KB |
Output is correct |
26 |
Correct |
1527 ms |
7836 KB |
Output is correct |
27 |
Correct |
1612 ms |
7972 KB |
Output is correct |
28 |
Correct |
1582 ms |
7916 KB |
Output is correct |
29 |
Correct |
1622 ms |
8032 KB |
Output is correct |
30 |
Execution timed out |
2050 ms |
8116 KB |
Time limit exceeded |
31 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
225 ms |
524288 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
2 |
Correct |
2 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
2 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
344 KB |
Output is correct |
7 |
Correct |
2 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
2 ms |
340 KB |
Output is correct |
11 |
Correct |
2 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
2 ms |
340 KB |
Output is correct |
14 |
Correct |
2 ms |
340 KB |
Output is correct |
15 |
Correct |
2 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
1 ms |
340 KB |
Output is correct |
20 |
Correct |
1 ms |
340 KB |
Output is correct |
21 |
Correct |
1127 ms |
7192 KB |
Output is correct |
22 |
Correct |
1092 ms |
7128 KB |
Output is correct |
23 |
Correct |
1012 ms |
6740 KB |
Output is correct |
24 |
Correct |
1132 ms |
7500 KB |
Output is correct |
25 |
Correct |
1104 ms |
7464 KB |
Output is correct |
26 |
Correct |
1527 ms |
7836 KB |
Output is correct |
27 |
Correct |
1612 ms |
7972 KB |
Output is correct |
28 |
Correct |
1582 ms |
7916 KB |
Output is correct |
29 |
Correct |
1622 ms |
8032 KB |
Output is correct |
30 |
Execution timed out |
2050 ms |
8116 KB |
Time limit exceeded |
31 |
Halted |
0 ms |
0 KB |
- |