# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
965445 |
2024-04-18T14:34:05 Z |
kim |
Boat (APIO16_boat) |
C++17 |
|
4 ms |
2396 KB |
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
#define eb emplace_back
const int md=1e9+7;
int a[505];
ll dp[505][505];
vector<int> comp;
int main(){
ios::sync_with_stdio(false); cin.tie(0);
int n; cin>>n;
for(int i=1;i<=n;++i) cin>>a[i]>>a[i], comp.eb(a[i]);
sort(comp.begin(),comp.end());
comp.erase(unique(comp.begin(),comp.end()),comp.end());
int m=comp.size();
for(int i=0;i<=m;++i) dp[0][i]=1;
for(int i=1;i<=n;++i){
int id=lower_bound(comp.begin(),comp.end(),a[i])-comp.begin()+1;
dp[i][0]=1;
dp[i][id]=dp[i-1][id-1];
for(int j=1;j<=m;++j) dp[i][j]=((dp[i][j]+dp[i-1][j]+dp[i][j-1]-dp[i-1][j-1])%md+md)%md;
}
cout<<(dp[n][m]+md-1)%md;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
2392 KB |
Output is correct |
2 |
Correct |
4 ms |
2396 KB |
Output is correct |
3 |
Correct |
4 ms |
2396 KB |
Output is correct |
4 |
Correct |
4 ms |
2268 KB |
Output is correct |
5 |
Correct |
3 ms |
2396 KB |
Output is correct |
6 |
Correct |
3 ms |
2392 KB |
Output is correct |
7 |
Correct |
4 ms |
2396 KB |
Output is correct |
8 |
Correct |
4 ms |
2392 KB |
Output is correct |
9 |
Correct |
4 ms |
2396 KB |
Output is correct |
10 |
Correct |
4 ms |
2396 KB |
Output is correct |
11 |
Correct |
4 ms |
2396 KB |
Output is correct |
12 |
Correct |
4 ms |
2396 KB |
Output is correct |
13 |
Correct |
4 ms |
2212 KB |
Output is correct |
14 |
Correct |
4 ms |
2264 KB |
Output is correct |
15 |
Correct |
4 ms |
2396 KB |
Output is correct |
16 |
Correct |
2 ms |
2396 KB |
Output is correct |
17 |
Correct |
2 ms |
2396 KB |
Output is correct |
18 |
Correct |
2 ms |
2396 KB |
Output is correct |
19 |
Correct |
2 ms |
2396 KB |
Output is correct |
20 |
Correct |
2 ms |
2396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
2392 KB |
Output is correct |
2 |
Correct |
4 ms |
2396 KB |
Output is correct |
3 |
Correct |
4 ms |
2396 KB |
Output is correct |
4 |
Correct |
4 ms |
2268 KB |
Output is correct |
5 |
Correct |
3 ms |
2396 KB |
Output is correct |
6 |
Correct |
3 ms |
2392 KB |
Output is correct |
7 |
Correct |
4 ms |
2396 KB |
Output is correct |
8 |
Correct |
4 ms |
2392 KB |
Output is correct |
9 |
Correct |
4 ms |
2396 KB |
Output is correct |
10 |
Correct |
4 ms |
2396 KB |
Output is correct |
11 |
Correct |
4 ms |
2396 KB |
Output is correct |
12 |
Correct |
4 ms |
2396 KB |
Output is correct |
13 |
Correct |
4 ms |
2212 KB |
Output is correct |
14 |
Correct |
4 ms |
2264 KB |
Output is correct |
15 |
Correct |
4 ms |
2396 KB |
Output is correct |
16 |
Correct |
2 ms |
2396 KB |
Output is correct |
17 |
Correct |
2 ms |
2396 KB |
Output is correct |
18 |
Correct |
2 ms |
2396 KB |
Output is correct |
19 |
Correct |
2 ms |
2396 KB |
Output is correct |
20 |
Correct |
2 ms |
2396 KB |
Output is correct |
21 |
Incorrect |
4 ms |
2396 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
860 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
2392 KB |
Output is correct |
2 |
Correct |
4 ms |
2396 KB |
Output is correct |
3 |
Correct |
4 ms |
2396 KB |
Output is correct |
4 |
Correct |
4 ms |
2268 KB |
Output is correct |
5 |
Correct |
3 ms |
2396 KB |
Output is correct |
6 |
Correct |
3 ms |
2392 KB |
Output is correct |
7 |
Correct |
4 ms |
2396 KB |
Output is correct |
8 |
Correct |
4 ms |
2392 KB |
Output is correct |
9 |
Correct |
4 ms |
2396 KB |
Output is correct |
10 |
Correct |
4 ms |
2396 KB |
Output is correct |
11 |
Correct |
4 ms |
2396 KB |
Output is correct |
12 |
Correct |
4 ms |
2396 KB |
Output is correct |
13 |
Correct |
4 ms |
2212 KB |
Output is correct |
14 |
Correct |
4 ms |
2264 KB |
Output is correct |
15 |
Correct |
4 ms |
2396 KB |
Output is correct |
16 |
Correct |
2 ms |
2396 KB |
Output is correct |
17 |
Correct |
2 ms |
2396 KB |
Output is correct |
18 |
Correct |
2 ms |
2396 KB |
Output is correct |
19 |
Correct |
2 ms |
2396 KB |
Output is correct |
20 |
Correct |
2 ms |
2396 KB |
Output is correct |
21 |
Incorrect |
4 ms |
2396 KB |
Output isn't correct |
22 |
Halted |
0 ms |
0 KB |
- |