# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
68551 |
2018-08-17T09:49:23 Z |
KLPP |
Boat (APIO16_boat) |
C++14 |
|
2000 ms |
525312 KB |
#include<iostream>
#include<stdio.h>
#include<vector>
using namespace std;
typedef long long int lld;
#define MOD 1000000007
int main(){
int n;
cin>>n;
pair<lld,lld> arr[n];
for(int i=0;i<n;i++)cin>>arr[i].first>>arr[i].second;
vector<lld> DP[n];
lld responde=0;
for(int i=0;i<n;i++){
for(int j=arr[i].first;j<=arr[i].second;j++){
int ans=1;
if(j>arr[i].first){
ans+=DP[i][DP[i].size()-1];
}
for(int k=0;k<i;k++){
if(j>arr[k].second){
ans+=DP[k][DP[k].size()-1];
ans%=MOD;
}else if(j>arr[k].first){
ans+=DP[k][j-arr[k].first-1];
ans%=MOD;
}
}
ans%=MOD;
DP[i].push_back(ans);
//responde+=ans;
}
responde+=DP[i][DP[i].size()-1];
responde%=MOD;
}
/*for(int i=0;i<n;i++){
for(int j=arr[i].first;j<=arr[i].second;j++){
cout<<DP[i][j-arr[i].first]<<" ";
}cout<<endl;
}*/
cout<<responde<<endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
376 KB |
Output is correct |
2 |
Correct |
4 ms |
448 KB |
Output is correct |
3 |
Correct |
3 ms |
448 KB |
Output is correct |
4 |
Correct |
3 ms |
532 KB |
Output is correct |
5 |
Correct |
4 ms |
552 KB |
Output is correct |
6 |
Correct |
4 ms |
576 KB |
Output is correct |
7 |
Correct |
3 ms |
576 KB |
Output is correct |
8 |
Correct |
3 ms |
576 KB |
Output is correct |
9 |
Correct |
4 ms |
620 KB |
Output is correct |
10 |
Correct |
3 ms |
748 KB |
Output is correct |
11 |
Correct |
3 ms |
748 KB |
Output is correct |
12 |
Correct |
4 ms |
748 KB |
Output is correct |
13 |
Correct |
4 ms |
748 KB |
Output is correct |
14 |
Correct |
4 ms |
748 KB |
Output is correct |
15 |
Correct |
4 ms |
748 KB |
Output is correct |
16 |
Correct |
3 ms |
748 KB |
Output is correct |
17 |
Correct |
3 ms |
748 KB |
Output is correct |
18 |
Correct |
4 ms |
748 KB |
Output is correct |
19 |
Correct |
4 ms |
748 KB |
Output is correct |
20 |
Correct |
4 ms |
748 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
376 KB |
Output is correct |
2 |
Correct |
4 ms |
448 KB |
Output is correct |
3 |
Correct |
3 ms |
448 KB |
Output is correct |
4 |
Correct |
3 ms |
532 KB |
Output is correct |
5 |
Correct |
4 ms |
552 KB |
Output is correct |
6 |
Correct |
4 ms |
576 KB |
Output is correct |
7 |
Correct |
3 ms |
576 KB |
Output is correct |
8 |
Correct |
3 ms |
576 KB |
Output is correct |
9 |
Correct |
4 ms |
620 KB |
Output is correct |
10 |
Correct |
3 ms |
748 KB |
Output is correct |
11 |
Correct |
3 ms |
748 KB |
Output is correct |
12 |
Correct |
4 ms |
748 KB |
Output is correct |
13 |
Correct |
4 ms |
748 KB |
Output is correct |
14 |
Correct |
4 ms |
748 KB |
Output is correct |
15 |
Correct |
4 ms |
748 KB |
Output is correct |
16 |
Correct |
3 ms |
748 KB |
Output is correct |
17 |
Correct |
3 ms |
748 KB |
Output is correct |
18 |
Correct |
4 ms |
748 KB |
Output is correct |
19 |
Correct |
4 ms |
748 KB |
Output is correct |
20 |
Correct |
4 ms |
748 KB |
Output is correct |
21 |
Execution timed out |
2025 ms |
9168 KB |
Time limit exceeded |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2058 ms |
525312 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
376 KB |
Output is correct |
2 |
Correct |
4 ms |
448 KB |
Output is correct |
3 |
Correct |
3 ms |
448 KB |
Output is correct |
4 |
Correct |
3 ms |
532 KB |
Output is correct |
5 |
Correct |
4 ms |
552 KB |
Output is correct |
6 |
Correct |
4 ms |
576 KB |
Output is correct |
7 |
Correct |
3 ms |
576 KB |
Output is correct |
8 |
Correct |
3 ms |
576 KB |
Output is correct |
9 |
Correct |
4 ms |
620 KB |
Output is correct |
10 |
Correct |
3 ms |
748 KB |
Output is correct |
11 |
Correct |
3 ms |
748 KB |
Output is correct |
12 |
Correct |
4 ms |
748 KB |
Output is correct |
13 |
Correct |
4 ms |
748 KB |
Output is correct |
14 |
Correct |
4 ms |
748 KB |
Output is correct |
15 |
Correct |
4 ms |
748 KB |
Output is correct |
16 |
Correct |
3 ms |
748 KB |
Output is correct |
17 |
Correct |
3 ms |
748 KB |
Output is correct |
18 |
Correct |
4 ms |
748 KB |
Output is correct |
19 |
Correct |
4 ms |
748 KB |
Output is correct |
20 |
Correct |
4 ms |
748 KB |
Output is correct |
21 |
Execution timed out |
2025 ms |
9168 KB |
Time limit exceeded |
22 |
Halted |
0 ms |
0 KB |
- |