# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
995462 |
2024-06-09T06:30:24 Z |
12345678 |
Trains (BOI24_trains) |
C++17 |
|
2000 ms |
1080 KB |
#include <bits/stdc++.h>
using namespace std;
const int nx=1e5+5, mod=1e9+7;
int n, d[nx], x[nx], dp[nx], res;
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>n;
for (int i=1; i<=n; i++) cin>>d[i]>>x[i];
dp[1]=1;
for (int i=2; i<=n; i++)
{
for (int j=1; j<i; j++)
{
if (d[j]==0) continue;
if (((i-j)%d[j])==0&&(((i-j)/d[j])<=x[j])) dp[i]=(dp[i]+dp[j])%mod;
}
}
for (int i=1; i<=n; i++) res=(res+dp[i])%mod;
cout<<res;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
140 ms |
524 KB |
Output is correct |
21 |
Correct |
14 ms |
348 KB |
Output is correct |
22 |
Correct |
117 ms |
544 KB |
Output is correct |
23 |
Correct |
68 ms |
348 KB |
Output is correct |
24 |
Correct |
17 ms |
344 KB |
Output is correct |
25 |
Correct |
95 ms |
348 KB |
Output is correct |
26 |
Correct |
38 ms |
348 KB |
Output is correct |
27 |
Correct |
132 ms |
348 KB |
Output is correct |
28 |
Correct |
99 ms |
348 KB |
Output is correct |
29 |
Correct |
180 ms |
348 KB |
Output is correct |
30 |
Correct |
100 ms |
560 KB |
Output is correct |
31 |
Correct |
94 ms |
344 KB |
Output is correct |
32 |
Correct |
180 ms |
348 KB |
Output is correct |
33 |
Correct |
131 ms |
344 KB |
Output is correct |
34 |
Correct |
100 ms |
564 KB |
Output is correct |
35 |
Correct |
99 ms |
548 KB |
Output is correct |
36 |
Correct |
126 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
68 ms |
532 KB |
Output is correct |
3 |
Correct |
37 ms |
348 KB |
Output is correct |
4 |
Correct |
132 ms |
552 KB |
Output is correct |
5 |
Execution timed out |
2070 ms |
1080 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2043 ms |
848 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
140 ms |
524 KB |
Output is correct |
21 |
Correct |
14 ms |
348 KB |
Output is correct |
22 |
Correct |
117 ms |
544 KB |
Output is correct |
23 |
Correct |
68 ms |
348 KB |
Output is correct |
24 |
Correct |
17 ms |
344 KB |
Output is correct |
25 |
Correct |
95 ms |
348 KB |
Output is correct |
26 |
Correct |
38 ms |
348 KB |
Output is correct |
27 |
Correct |
132 ms |
348 KB |
Output is correct |
28 |
Correct |
99 ms |
348 KB |
Output is correct |
29 |
Correct |
180 ms |
348 KB |
Output is correct |
30 |
Correct |
100 ms |
560 KB |
Output is correct |
31 |
Correct |
94 ms |
344 KB |
Output is correct |
32 |
Correct |
180 ms |
348 KB |
Output is correct |
33 |
Correct |
131 ms |
344 KB |
Output is correct |
34 |
Correct |
100 ms |
564 KB |
Output is correct |
35 |
Correct |
99 ms |
548 KB |
Output is correct |
36 |
Correct |
126 ms |
344 KB |
Output is correct |
37 |
Correct |
0 ms |
348 KB |
Output is correct |
38 |
Correct |
68 ms |
532 KB |
Output is correct |
39 |
Correct |
37 ms |
348 KB |
Output is correct |
40 |
Correct |
132 ms |
552 KB |
Output is correct |
41 |
Execution timed out |
2070 ms |
1080 KB |
Time limit exceeded |
42 |
Halted |
0 ms |
0 KB |
- |