Submission #699441

# Submission time Handle Problem Language Result Execution time Memory
699441 2023-02-17T00:10:35 Z aelf2k23 초음속철도 (OJUZ11_rail) C++14
45 / 100
3000 ms 7888 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);
    }
    vecc.push_back(n);

    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 nn = 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[nn] << '\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 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 Correct 0 ms 212 KB Output is correct
10 Correct 0 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 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 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 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 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 Correct 0 ms 212 KB Output is correct
10 Correct 0 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 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 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 1 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 0 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is 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 1 ms 236 KB Output is correct
32 Correct 1 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 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 18 ms 612 KB Output is correct
5 Execution timed out 3096 ms 7136 KB Time limit exceeded
6 Execution timed out 3085 ms 7484 KB Time limit exceeded
7 Execution timed out 3079 ms 7492 KB Time limit exceeded
8 Correct 0 ms 212 KB Output is correct
9 Execution timed out 3094 ms 6860 KB Time limit exceeded
10 Execution timed out 3068 ms 7220 KB Time limit exceeded
11 Execution timed out 3085 ms 4468 KB Time limit exceeded
12 Execution timed out 3092 ms 7384 KB Time limit exceeded
13 Execution timed out 3072 ms 7228 KB Time limit exceeded
14 Correct 121 ms 6584 KB Output is correct
15 Execution timed out 3091 ms 7256 KB Time limit exceeded
16 Correct 135 ms 6664 KB Output is correct
17 Execution timed out 3094 ms 7516 KB Time limit exceeded
18 Execution timed out 3092 ms 7344 KB Time limit exceeded
19 Execution timed out 3081 ms 7416 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 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 Correct 0 ms 212 KB Output is correct
10 Correct 0 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 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 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 1 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 0 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is 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 1 ms 236 KB Output is correct
32 Correct 1 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 96 ms 648 KB Output is correct
37 Correct 65 ms 624 KB Output is correct
38 Correct 25 ms 592 KB Output is correct
39 Correct 2 ms 596 KB Output is correct
40 Correct 23 ms 640 KB Output is correct
41 Correct 77 ms 652 KB Output is correct
42 Correct 94 ms 656 KB Output is correct
43 Correct 0 ms 212 KB Output is correct
44 Correct 69 ms 596 KB Output is correct
45 Correct 3 ms 596 KB Output is correct
46 Correct 65 ms 632 KB Output is correct
47 Correct 50 ms 636 KB Output is correct
48 Correct 52 ms 624 KB Output is correct
49 Correct 6 ms 596 KB Output is correct
50 Correct 5 ms 596 KB Output is correct
51 Correct 5 ms 596 KB Output is correct
52 Correct 5 ms 340 KB Output is correct
53 Correct 75 ms 652 KB Output is correct
54 Correct 20 ms 500 KB Output is correct
55 Correct 93 ms 660 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 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 Correct 0 ms 212 KB Output is correct
10 Correct 0 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 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 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 1 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 0 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is 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 1 ms 236 KB Output is correct
32 Correct 1 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 0 ms 212 KB Output is correct
37 Correct 0 ms 212 KB Output is correct
38 Correct 0 ms 212 KB Output is correct
39 Correct 18 ms 612 KB Output is correct
40 Execution timed out 3096 ms 7136 KB Time limit exceeded
41 Execution timed out 3085 ms 7484 KB Time limit exceeded
42 Execution timed out 3079 ms 7492 KB Time limit exceeded
43 Correct 0 ms 212 KB Output is correct
44 Execution timed out 3094 ms 6860 KB Time limit exceeded
45 Execution timed out 3068 ms 7220 KB Time limit exceeded
46 Execution timed out 3085 ms 4468 KB Time limit exceeded
47 Execution timed out 3092 ms 7384 KB Time limit exceeded
48 Execution timed out 3072 ms 7228 KB Time limit exceeded
49 Correct 121 ms 6584 KB Output is correct
50 Execution timed out 3091 ms 7256 KB Time limit exceeded
51 Correct 135 ms 6664 KB Output is correct
52 Execution timed out 3094 ms 7516 KB Time limit exceeded
53 Execution timed out 3092 ms 7344 KB Time limit exceeded
54 Execution timed out 3081 ms 7416 KB Time limit exceeded
55 Correct 96 ms 648 KB Output is correct
56 Correct 65 ms 624 KB Output is correct
57 Correct 25 ms 592 KB Output is correct
58 Correct 2 ms 596 KB Output is correct
59 Correct 23 ms 640 KB Output is correct
60 Correct 77 ms 652 KB Output is correct
61 Correct 94 ms 656 KB Output is correct
62 Correct 0 ms 212 KB Output is correct
63 Correct 69 ms 596 KB Output is correct
64 Correct 3 ms 596 KB Output is correct
65 Correct 65 ms 632 KB Output is correct
66 Correct 50 ms 636 KB Output is correct
67 Correct 52 ms 624 KB Output is correct
68 Correct 6 ms 596 KB Output is correct
69 Correct 5 ms 596 KB Output is correct
70 Correct 5 ms 596 KB Output is correct
71 Correct 5 ms 340 KB Output is correct
72 Correct 75 ms 652 KB Output is correct
73 Correct 20 ms 500 KB Output is correct
74 Correct 93 ms 660 KB Output is correct
75 Execution timed out 3058 ms 7608 KB Time limit exceeded
76 Execution timed out 3080 ms 6572 KB Time limit exceeded
77 Correct 1147 ms 6556 KB Output is correct
78 Correct 75 ms 6644 KB Output is correct
79 Execution timed out 3074 ms 7072 KB Time limit exceeded
80 Execution timed out 3079 ms 7588 KB Time limit exceeded
81 Correct 44 ms 596 KB Output is correct
82 Execution timed out 3077 ms 7176 KB Time limit exceeded
83 Correct 114 ms 6696 KB Output is correct
84 Execution timed out 3078 ms 7404 KB Time limit exceeded
85 Execution timed out 3081 ms 7292 KB Time limit exceeded
86 Execution timed out 3077 ms 7352 KB Time limit exceeded
87 Correct 199 ms 6588 KB Output is correct
88 Correct 183 ms 6628 KB Output is correct
89 Execution timed out 3079 ms 7704 KB Time limit exceeded
90 Execution timed out 3078 ms 7724 KB Time limit exceeded
91 Execution timed out 3078 ms 7888 KB Time limit exceeded
92 Execution timed out 3077 ms 7652 KB Time limit exceeded
93 Execution timed out 3085 ms 7532 KB Time limit exceeded
94 Execution timed out 3100 ms 7500 KB Time limit exceeded
95 Execution timed out 3076 ms 7660 KB Time limit exceeded