# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
699439 |
2023-02-16T23:59:47 Z |
aelf2k23 |
초음속철도 (OJUZ11_rail) |
C++14 |
|
3000 ms |
7756 KB |
#include<bits/stdc++.h>
#define int long long
#define ll long long
#define fr first
#define sc second
#define all(s) s.begin(), s.end()
using namespace std;
const int nmax = 200005;
const int mod = 1e9 + 7;
int n, m, dp[nmax];
pair<int,int> a[nmax];
vector<int>vecc;
int32_t main(){
cin >> n >> m;
for(int i=1;i<=m;i++){
cin >> a[i].fr >> a[i].sc;
swap(a[i].fr, a[i].sc);
vecc.push_back(a[i].fr);
vecc.push_back(a[i].sc);
}
sort(all(vecc));
vecc.resize(unique(all(vecc)) - vecc.begin());
for(int i=1;i<=m;i++){
a[i].fr = lower_bound(all(vecc), a[i].fr) - vecc.begin();
a[i].sc = lower_bound(all(vecc), a[i].sc) - vecc.begin();
}
sort(a + 1, a + m + 1);
for(int i=1;i<=m;i++){
swap(a[i].fr, a[i].sc);
}
int n = vecc.size() - 1;
dp[0] = 1;
for(int i=1;i<=m;i++){
for(int j=0;j<a[i].fr;j++){
dp[j] = dp[j] * 2LL % mod;
}
for(int j=a[i].sc;j>=a[i].fr;j--){
dp[a[i].sc] = (dp[a[i].sc] + dp[j]) % mod;
}
}
cout << dp[n] << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
304 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
300 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
0 ms |
308 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
304 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
300 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
0 ms |
308 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
308 KB |
Output is correct |
20 |
Correct |
0 ms |
308 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
1 ms |
308 KB |
Output is correct |
23 |
Correct |
0 ms |
212 KB |
Output is correct |
24 |
Correct |
0 ms |
212 KB |
Output is correct |
25 |
Correct |
0 ms |
304 KB |
Output is correct |
26 |
Correct |
0 ms |
212 KB |
Output is correct |
27 |
Incorrect |
1 ms |
308 KB |
Output isn't correct |
28 |
Correct |
0 ms |
212 KB |
Output is correct |
29 |
Correct |
1 ms |
212 KB |
Output is correct |
30 |
Correct |
1 ms |
212 KB |
Output is correct |
31 |
Correct |
0 ms |
212 KB |
Output is correct |
32 |
Correct |
1 ms |
312 KB |
Output is correct |
33 |
Correct |
1 ms |
212 KB |
Output is correct |
34 |
Correct |
1 ms |
212 KB |
Output is correct |
35 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
304 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
4 |
Correct |
17 ms |
596 KB |
Output is correct |
5 |
Execution timed out |
3070 ms |
7344 KB |
Time limit exceeded |
6 |
Execution timed out |
3093 ms |
7488 KB |
Time limit exceeded |
7 |
Execution timed out |
3040 ms |
7460 KB |
Time limit exceeded |
8 |
Correct |
1 ms |
256 KB |
Output is correct |
9 |
Execution timed out |
3059 ms |
6956 KB |
Time limit exceeded |
10 |
Execution timed out |
3067 ms |
7544 KB |
Time limit exceeded |
11 |
Execution timed out |
3069 ms |
4680 KB |
Time limit exceeded |
12 |
Execution timed out |
3069 ms |
7732 KB |
Time limit exceeded |
13 |
Execution timed out |
3068 ms |
7476 KB |
Time limit exceeded |
14 |
Correct |
123 ms |
6804 KB |
Output is correct |
15 |
Execution timed out |
3071 ms |
7436 KB |
Time limit exceeded |
16 |
Correct |
137 ms |
6760 KB |
Output is correct |
17 |
Execution timed out |
3089 ms |
7460 KB |
Time limit exceeded |
18 |
Execution timed out |
3086 ms |
7572 KB |
Time limit exceeded |
19 |
Execution timed out |
3075 ms |
7448 KB |
Time limit exceeded |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
304 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
300 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
0 ms |
308 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
308 KB |
Output is correct |
20 |
Correct |
0 ms |
308 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
1 ms |
308 KB |
Output is correct |
23 |
Correct |
0 ms |
212 KB |
Output is correct |
24 |
Correct |
0 ms |
212 KB |
Output is correct |
25 |
Correct |
0 ms |
304 KB |
Output is correct |
26 |
Correct |
0 ms |
212 KB |
Output is correct |
27 |
Incorrect |
1 ms |
308 KB |
Output isn't correct |
28 |
Correct |
0 ms |
212 KB |
Output is correct |
29 |
Correct |
1 ms |
212 KB |
Output is correct |
30 |
Correct |
1 ms |
212 KB |
Output is correct |
31 |
Correct |
0 ms |
212 KB |
Output is correct |
32 |
Correct |
1 ms |
312 KB |
Output is correct |
33 |
Correct |
1 ms |
212 KB |
Output is correct |
34 |
Correct |
1 ms |
212 KB |
Output is correct |
35 |
Correct |
1 ms |
212 KB |
Output is correct |
36 |
Correct |
95 ms |
704 KB |
Output is correct |
37 |
Correct |
68 ms |
612 KB |
Output is correct |
38 |
Correct |
25 ms |
468 KB |
Output is correct |
39 |
Correct |
2 ms |
596 KB |
Output is correct |
40 |
Correct |
25 ms |
720 KB |
Output is correct |
41 |
Correct |
78 ms |
736 KB |
Output is correct |
42 |
Correct |
96 ms |
752 KB |
Output is correct |
43 |
Correct |
1 ms |
212 KB |
Output is correct |
44 |
Correct |
71 ms |
636 KB |
Output is correct |
45 |
Correct |
3 ms |
596 KB |
Output is correct |
46 |
Correct |
64 ms |
688 KB |
Output is correct |
47 |
Correct |
52 ms |
728 KB |
Output is correct |
48 |
Correct |
55 ms |
724 KB |
Output is correct |
49 |
Correct |
6 ms |
596 KB |
Output is correct |
50 |
Correct |
6 ms |
700 KB |
Output is correct |
51 |
Correct |
5 ms |
704 KB |
Output is correct |
52 |
Correct |
5 ms |
352 KB |
Output is correct |
53 |
Correct |
77 ms |
716 KB |
Output is correct |
54 |
Correct |
20 ms |
468 KB |
Output is correct |
55 |
Correct |
93 ms |
744 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
304 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
300 KB |
Output is correct |
15 |
Correct |
1 ms |
212 KB |
Output is correct |
16 |
Correct |
0 ms |
308 KB |
Output is correct |
17 |
Correct |
0 ms |
212 KB |
Output is correct |
18 |
Correct |
0 ms |
212 KB |
Output is correct |
19 |
Correct |
1 ms |
308 KB |
Output is correct |
20 |
Correct |
0 ms |
308 KB |
Output is correct |
21 |
Correct |
0 ms |
212 KB |
Output is correct |
22 |
Correct |
1 ms |
308 KB |
Output is correct |
23 |
Correct |
0 ms |
212 KB |
Output is correct |
24 |
Correct |
0 ms |
212 KB |
Output is correct |
25 |
Correct |
0 ms |
304 KB |
Output is correct |
26 |
Correct |
0 ms |
212 KB |
Output is correct |
27 |
Incorrect |
1 ms |
308 KB |
Output isn't correct |
28 |
Correct |
0 ms |
212 KB |
Output is correct |
29 |
Correct |
1 ms |
212 KB |
Output is correct |
30 |
Correct |
1 ms |
212 KB |
Output is correct |
31 |
Correct |
0 ms |
212 KB |
Output is correct |
32 |
Correct |
1 ms |
312 KB |
Output is correct |
33 |
Correct |
1 ms |
212 KB |
Output is correct |
34 |
Correct |
1 ms |
212 KB |
Output is correct |
35 |
Correct |
1 ms |
212 KB |
Output is correct |
36 |
Correct |
0 ms |
304 KB |
Output is correct |
37 |
Correct |
1 ms |
212 KB |
Output is correct |
38 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
39 |
Correct |
17 ms |
596 KB |
Output is correct |
40 |
Execution timed out |
3070 ms |
7344 KB |
Time limit exceeded |
41 |
Execution timed out |
3093 ms |
7488 KB |
Time limit exceeded |
42 |
Execution timed out |
3040 ms |
7460 KB |
Time limit exceeded |
43 |
Correct |
1 ms |
256 KB |
Output is correct |
44 |
Execution timed out |
3059 ms |
6956 KB |
Time limit exceeded |
45 |
Execution timed out |
3067 ms |
7544 KB |
Time limit exceeded |
46 |
Execution timed out |
3069 ms |
4680 KB |
Time limit exceeded |
47 |
Execution timed out |
3069 ms |
7732 KB |
Time limit exceeded |
48 |
Execution timed out |
3068 ms |
7476 KB |
Time limit exceeded |
49 |
Correct |
123 ms |
6804 KB |
Output is correct |
50 |
Execution timed out |
3071 ms |
7436 KB |
Time limit exceeded |
51 |
Correct |
137 ms |
6760 KB |
Output is correct |
52 |
Execution timed out |
3089 ms |
7460 KB |
Time limit exceeded |
53 |
Execution timed out |
3086 ms |
7572 KB |
Time limit exceeded |
54 |
Execution timed out |
3075 ms |
7448 KB |
Time limit exceeded |
55 |
Correct |
95 ms |
704 KB |
Output is correct |
56 |
Correct |
68 ms |
612 KB |
Output is correct |
57 |
Correct |
25 ms |
468 KB |
Output is correct |
58 |
Correct |
2 ms |
596 KB |
Output is correct |
59 |
Correct |
25 ms |
720 KB |
Output is correct |
60 |
Correct |
78 ms |
736 KB |
Output is correct |
61 |
Correct |
96 ms |
752 KB |
Output is correct |
62 |
Correct |
1 ms |
212 KB |
Output is correct |
63 |
Correct |
71 ms |
636 KB |
Output is correct |
64 |
Correct |
3 ms |
596 KB |
Output is correct |
65 |
Correct |
64 ms |
688 KB |
Output is correct |
66 |
Correct |
52 ms |
728 KB |
Output is correct |
67 |
Correct |
55 ms |
724 KB |
Output is correct |
68 |
Correct |
6 ms |
596 KB |
Output is correct |
69 |
Correct |
6 ms |
700 KB |
Output is correct |
70 |
Correct |
5 ms |
704 KB |
Output is correct |
71 |
Correct |
5 ms |
352 KB |
Output is correct |
72 |
Correct |
77 ms |
716 KB |
Output is correct |
73 |
Correct |
20 ms |
468 KB |
Output is correct |
74 |
Correct |
93 ms |
744 KB |
Output is correct |
75 |
Execution timed out |
3080 ms |
7624 KB |
Time limit exceeded |
76 |
Execution timed out |
3079 ms |
5508 KB |
Time limit exceeded |
77 |
Correct |
1182 ms |
6708 KB |
Output is correct |
78 |
Correct |
80 ms |
6716 KB |
Output is correct |
79 |
Execution timed out |
3091 ms |
7088 KB |
Time limit exceeded |
80 |
Execution timed out |
3084 ms |
7660 KB |
Time limit exceeded |
81 |
Correct |
44 ms |
672 KB |
Output is correct |
82 |
Execution timed out |
3061 ms |
7528 KB |
Time limit exceeded |
83 |
Correct |
122 ms |
6796 KB |
Output is correct |
84 |
Execution timed out |
3064 ms |
7512 KB |
Time limit exceeded |
85 |
Execution timed out |
3069 ms |
7528 KB |
Time limit exceeded |
86 |
Execution timed out |
3072 ms |
7436 KB |
Time limit exceeded |
87 |
Correct |
204 ms |
6712 KB |
Output is correct |
88 |
Correct |
181 ms |
6812 KB |
Output is correct |
89 |
Execution timed out |
3035 ms |
7636 KB |
Time limit exceeded |
90 |
Execution timed out |
3063 ms |
7700 KB |
Time limit exceeded |
91 |
Execution timed out |
3079 ms |
7740 KB |
Time limit exceeded |
92 |
Execution timed out |
3082 ms |
7600 KB |
Time limit exceeded |
93 |
Execution timed out |
3071 ms |
7456 KB |
Time limit exceeded |
94 |
Execution timed out |
3093 ms |
7600 KB |
Time limit exceeded |
95 |
Execution timed out |
3077 ms |
7756 KB |
Time limit exceeded |