# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
257895 |
2020-08-05T03:07:45 Z |
daniel920712 |
Boat (APIO16_boat) |
C++14 |
|
2000 ms |
8312 KB |
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <set>
#include <map>
using namespace std;
long long MOD=1e9+7;
map < pair < long long , long long > , long long > all;
long long N;
long long a[505],b[505];
long long F(long long x,long long y)
{
long long i;
//printf("%lld %lld\n",x,y);
if(x==0) return y!=1e9+5;
if(all.find(make_pair(x,y))!=all.end()) return all[make_pair(x,y)];
all[make_pair(x,y)]=F(x-1,y);
for(i=a[x];i<=min(b[x],y-1);i++)
{
all[make_pair(x,y)]+=F(x-1,i);
all[make_pair(x,y)]%=MOD;
}
//printf("%lld %lld %lld\n",x,y,all[make_pair(x,y)]);
return all[make_pair(x,y)];
}
int main()
{
long long N,M,i;
scanf("%lld",&N);
for(i=1;i<=N;i++) scanf("%lld %lld",&a[i],&b[i]);
printf("%lld\n",F(N,1e9+5));
return 0;
}
Compilation message
boat.cpp: In function 'int main()':
boat.cpp:30:17: warning: unused variable 'M' [-Wunused-variable]
long long N,M,i;
^
boat.cpp:31:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
scanf("%lld",&N);
~~~~~^~~~~~~~~~~
boat.cpp:32:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
for(i=1;i<=N;i++) scanf("%lld %lld",&a[i],&b[i]);
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
87 ms |
8312 KB |
Output is correct |
2 |
Correct |
87 ms |
8312 KB |
Output is correct |
3 |
Correct |
86 ms |
8188 KB |
Output is correct |
4 |
Correct |
85 ms |
8184 KB |
Output is correct |
5 |
Correct |
86 ms |
8184 KB |
Output is correct |
6 |
Correct |
119 ms |
8184 KB |
Output is correct |
7 |
Correct |
114 ms |
8184 KB |
Output is correct |
8 |
Correct |
114 ms |
8200 KB |
Output is correct |
9 |
Correct |
115 ms |
8184 KB |
Output is correct |
10 |
Correct |
115 ms |
8184 KB |
Output is correct |
11 |
Correct |
110 ms |
8312 KB |
Output is correct |
12 |
Correct |
116 ms |
8184 KB |
Output is correct |
13 |
Correct |
115 ms |
8200 KB |
Output is correct |
14 |
Correct |
126 ms |
8184 KB |
Output is correct |
15 |
Correct |
115 ms |
8232 KB |
Output is correct |
16 |
Correct |
31 ms |
2552 KB |
Output is correct |
17 |
Correct |
25 ms |
2688 KB |
Output is correct |
18 |
Correct |
24 ms |
2560 KB |
Output is correct |
19 |
Correct |
35 ms |
2680 KB |
Output is correct |
20 |
Correct |
24 ms |
2680 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
87 ms |
8312 KB |
Output is correct |
2 |
Correct |
87 ms |
8312 KB |
Output is correct |
3 |
Correct |
86 ms |
8188 KB |
Output is correct |
4 |
Correct |
85 ms |
8184 KB |
Output is correct |
5 |
Correct |
86 ms |
8184 KB |
Output is correct |
6 |
Correct |
119 ms |
8184 KB |
Output is correct |
7 |
Correct |
114 ms |
8184 KB |
Output is correct |
8 |
Correct |
114 ms |
8200 KB |
Output is correct |
9 |
Correct |
115 ms |
8184 KB |
Output is correct |
10 |
Correct |
115 ms |
8184 KB |
Output is correct |
11 |
Correct |
110 ms |
8312 KB |
Output is correct |
12 |
Correct |
116 ms |
8184 KB |
Output is correct |
13 |
Correct |
115 ms |
8200 KB |
Output is correct |
14 |
Correct |
126 ms |
8184 KB |
Output is correct |
15 |
Correct |
115 ms |
8232 KB |
Output is correct |
16 |
Correct |
31 ms |
2552 KB |
Output is correct |
17 |
Correct |
25 ms |
2688 KB |
Output is correct |
18 |
Correct |
24 ms |
2560 KB |
Output is correct |
19 |
Correct |
35 ms |
2680 KB |
Output is correct |
20 |
Correct |
24 ms |
2680 KB |
Output is correct |
21 |
Execution timed out |
2076 ms |
1236 KB |
Time limit exceeded |
22 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2086 ms |
384 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
87 ms |
8312 KB |
Output is correct |
2 |
Correct |
87 ms |
8312 KB |
Output is correct |
3 |
Correct |
86 ms |
8188 KB |
Output is correct |
4 |
Correct |
85 ms |
8184 KB |
Output is correct |
5 |
Correct |
86 ms |
8184 KB |
Output is correct |
6 |
Correct |
119 ms |
8184 KB |
Output is correct |
7 |
Correct |
114 ms |
8184 KB |
Output is correct |
8 |
Correct |
114 ms |
8200 KB |
Output is correct |
9 |
Correct |
115 ms |
8184 KB |
Output is correct |
10 |
Correct |
115 ms |
8184 KB |
Output is correct |
11 |
Correct |
110 ms |
8312 KB |
Output is correct |
12 |
Correct |
116 ms |
8184 KB |
Output is correct |
13 |
Correct |
115 ms |
8200 KB |
Output is correct |
14 |
Correct |
126 ms |
8184 KB |
Output is correct |
15 |
Correct |
115 ms |
8232 KB |
Output is correct |
16 |
Correct |
31 ms |
2552 KB |
Output is correct |
17 |
Correct |
25 ms |
2688 KB |
Output is correct |
18 |
Correct |
24 ms |
2560 KB |
Output is correct |
19 |
Correct |
35 ms |
2680 KB |
Output is correct |
20 |
Correct |
24 ms |
2680 KB |
Output is correct |
21 |
Execution timed out |
2076 ms |
1236 KB |
Time limit exceeded |
22 |
Halted |
0 ms |
0 KB |
- |