Submission #699440

# Submission time Handle Problem Language Result Execution time Memory
699440 2023-02-17T00:05:30 Z aelf2k23 초음속철도 (OJUZ11_rail) C++14
0 / 100
3000 ms 7660 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 = 400005;

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 1 ms 212 KB Output is correct
2 Correct 1 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 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Incorrect 0 ms 212 KB Output isn't correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 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 1 ms 212 KB Output is correct
2 Correct 1 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 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Incorrect 0 ms 212 KB Output isn't correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Incorrect 0 ms 212 KB Output isn't correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 0 ms 212 KB Output is correct
34 Correct 0 ms 212 KB Output is correct
35 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Correct 17 ms 608 KB Output is correct
5 Execution timed out 3069 ms 7168 KB Time limit exceeded
6 Execution timed out 3085 ms 7468 KB Time limit exceeded
7 Execution timed out 3071 ms 7388 KB Time limit exceeded
8 Correct 0 ms 212 KB Output is correct
9 Execution timed out 3092 ms 6972 KB Time limit exceeded
10 Execution timed out 3059 ms 7144 KB Time limit exceeded
11 Execution timed out 3082 ms 4488 KB Time limit exceeded
12 Execution timed out 3072 ms 7432 KB Time limit exceeded
13 Execution timed out 3083 ms 7348 KB Time limit exceeded
14 Correct 128 ms 6592 KB Output is correct
15 Execution timed out 3088 ms 7116 KB Time limit exceeded
16 Correct 144 ms 6756 KB Output is correct
17 Execution timed out 3089 ms 7356 KB Time limit exceeded
18 Execution timed out 3096 ms 7320 KB Time limit exceeded
19 Execution timed out 3067 ms 7240 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 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 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Incorrect 0 ms 212 KB Output isn't correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Incorrect 0 ms 212 KB Output isn't correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 0 ms 212 KB Output is correct
34 Correct 0 ms 212 KB Output is correct
35 Correct 0 ms 212 KB Output is correct
36 Correct 99 ms 768 KB Output is correct
37 Correct 66 ms 540 KB Output is correct
38 Correct 25 ms 528 KB Output is correct
39 Correct 2 ms 596 KB Output is correct
40 Correct 24 ms 624 KB Output is correct
41 Correct 77 ms 644 KB Output is correct
42 Correct 97 ms 660 KB Output is correct
43 Correct 0 ms 212 KB Output is correct
44 Correct 74 ms 632 KB Output is correct
45 Correct 5 ms 596 KB Output is correct
46 Correct 70 ms 596 KB Output is correct
47 Correct 52 ms 628 KB Output is correct
48 Correct 51 ms 596 KB Output is correct
49 Correct 5 ms 608 KB Output is correct
50 Correct 5 ms 596 KB Output is correct
51 Correct 5 ms 492 KB Output is correct
52 Correct 5 ms 340 KB Output is correct
53 Correct 80 ms 644 KB Output is correct
54 Correct 21 ms 468 KB Output is correct
55 Correct 97 ms 640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 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 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Incorrect 0 ms 212 KB Output isn't correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Incorrect 0 ms 212 KB Output isn't correct
28 Correct 0 ms 212 KB Output is correct
29 Correct 0 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 0 ms 212 KB Output is correct
32 Correct 0 ms 212 KB Output is correct
33 Correct 0 ms 212 KB Output is correct
34 Correct 0 ms 212 KB Output is correct
35 Correct 0 ms 212 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 0 ms 212 KB Output is correct
38 Incorrect 0 ms 212 KB Output isn't correct
39 Correct 17 ms 608 KB Output is correct
40 Execution timed out 3069 ms 7168 KB Time limit exceeded
41 Execution timed out 3085 ms 7468 KB Time limit exceeded
42 Execution timed out 3071 ms 7388 KB Time limit exceeded
43 Correct 0 ms 212 KB Output is correct
44 Execution timed out 3092 ms 6972 KB Time limit exceeded
45 Execution timed out 3059 ms 7144 KB Time limit exceeded
46 Execution timed out 3082 ms 4488 KB Time limit exceeded
47 Execution timed out 3072 ms 7432 KB Time limit exceeded
48 Execution timed out 3083 ms 7348 KB Time limit exceeded
49 Correct 128 ms 6592 KB Output is correct
50 Execution timed out 3088 ms 7116 KB Time limit exceeded
51 Correct 144 ms 6756 KB Output is correct
52 Execution timed out 3089 ms 7356 KB Time limit exceeded
53 Execution timed out 3096 ms 7320 KB Time limit exceeded
54 Execution timed out 3067 ms 7240 KB Time limit exceeded
55 Correct 99 ms 768 KB Output is correct
56 Correct 66 ms 540 KB Output is correct
57 Correct 25 ms 528 KB Output is correct
58 Correct 2 ms 596 KB Output is correct
59 Correct 24 ms 624 KB Output is correct
60 Correct 77 ms 644 KB Output is correct
61 Correct 97 ms 660 KB Output is correct
62 Correct 0 ms 212 KB Output is correct
63 Correct 74 ms 632 KB Output is correct
64 Correct 5 ms 596 KB Output is correct
65 Correct 70 ms 596 KB Output is correct
66 Correct 52 ms 628 KB Output is correct
67 Correct 51 ms 596 KB Output is correct
68 Correct 5 ms 608 KB Output is correct
69 Correct 5 ms 596 KB Output is correct
70 Correct 5 ms 492 KB Output is correct
71 Correct 5 ms 340 KB Output is correct
72 Correct 80 ms 644 KB Output is correct
73 Correct 21 ms 468 KB Output is correct
74 Correct 97 ms 640 KB Output is correct
75 Execution timed out 3079 ms 7584 KB Time limit exceeded
76 Execution timed out 3080 ms 5288 KB Time limit exceeded
77 Correct 1161 ms 6484 KB Output is correct
78 Correct 92 ms 6612 KB Output is correct
79 Execution timed out 3093 ms 7152 KB Time limit exceeded
80 Execution timed out 3100 ms 7476 KB Time limit exceeded
81 Correct 43 ms 612 KB Output is correct
82 Execution timed out 3099 ms 7136 KB Time limit exceeded
83 Correct 121 ms 6828 KB Output is correct
84 Execution timed out 3090 ms 7392 KB Time limit exceeded
85 Execution timed out 3047 ms 7344 KB Time limit exceeded
86 Execution timed out 3074 ms 7252 KB Time limit exceeded
87 Correct 199 ms 6608 KB Output is correct
88 Correct 182 ms 6652 KB Output is correct
89 Execution timed out 3097 ms 7468 KB Time limit exceeded
90 Execution timed out 3079 ms 7564 KB Time limit exceeded
91 Execution timed out 3088 ms 7640 KB Time limit exceeded
92 Execution timed out 3094 ms 7536 KB Time limit exceeded
93 Execution timed out 3085 ms 7628 KB Time limit exceeded
94 Execution timed out 3081 ms 7488 KB Time limit exceeded
95 Execution timed out 3079 ms 7660 KB Time limit exceeded