답안 #20389

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
20389 2017-02-10T17:24:56 Z 윤지학(#34, gs13068) 초음속철도 (OJUZ11_rail) C++
45 / 100
69 ms 12436 KB
#include <cstdio>
#include <algorithm>

using namespace std;

const int o = 1 << 19, p = 1000000007;

pair<int, int> a[200002];
int t[400004];
int d[1 << 20];
int e[1 << 20];

int main() {
	int i, j, k, n, m, r = 0;
	scanf("%d%d", &t[1], &n);
	if (n > 5000) return 0;
	t[0] = 1;
	for (i = 1; i <= n; i++) {
		scanf("%d%d", &t[i << 1], &t[i << 1 | 1]);
		a[i].first = t[i << 1 | 1];
		a[i].second = -t[i << 1];
	}
	sort(a + 1, a + n + 1);
	sort(t, t + n + n + 2);
	m = unique(t, t + n + n + 2) - t;
	d[1] = 1;
	for (i = 1; i <= n; i++) {
		a[i].first = upper_bound(t, t + m, a[i].first) - t;
		a[i].second = upper_bound(t, t + m, -a[i].second) - t;
		k = d[a[i].second];
		if (a[i].first == m) r = (r + k) % p;
		for (j = 0; j < a[i].second; j++) d[j] = (d[j] << 1) % p;
		for (j = a[i].second; j <= a[i].first; j++) d[j] = (d[j] + k) % p;
	}
	printf("%d", r);
}

Compilation message

rail.cpp: In function 'int main()':
rail.cpp:15:26: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d", &t[1], &n);
                          ^
rail.cpp:19:44: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d", &t[i << 1], &t[i << 1 | 1]);
                                            ^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 12436 KB Output is correct
2 Correct 0 ms 12436 KB Output is correct
3 Correct 0 ms 12436 KB Output is correct
4 Correct 0 ms 12436 KB Output is correct
5 Correct 0 ms 12436 KB Output is correct
6 Correct 0 ms 12436 KB Output is correct
7 Correct 0 ms 12436 KB Output is correct
8 Correct 0 ms 12436 KB Output is correct
9 Correct 0 ms 12436 KB Output is correct
10 Correct 0 ms 12436 KB Output is correct
11 Correct 0 ms 12436 KB Output is correct
12 Correct 0 ms 12436 KB Output is correct
13 Correct 0 ms 12436 KB Output is correct
14 Correct 0 ms 12436 KB Output is correct
15 Correct 0 ms 12436 KB Output is correct
16 Correct 0 ms 12436 KB Output is correct
17 Correct 0 ms 12436 KB Output is correct
18 Correct 0 ms 12436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 12436 KB Output is correct
2 Correct 0 ms 12436 KB Output is correct
3 Correct 0 ms 12436 KB Output is correct
4 Correct 0 ms 12436 KB Output is correct
5 Correct 0 ms 12436 KB Output is correct
6 Correct 0 ms 12436 KB Output is correct
7 Correct 0 ms 12436 KB Output is correct
8 Correct 0 ms 12436 KB Output is correct
9 Correct 0 ms 12436 KB Output is correct
10 Correct 0 ms 12436 KB Output is correct
11 Correct 0 ms 12436 KB Output is correct
12 Correct 0 ms 12436 KB Output is correct
13 Correct 0 ms 12436 KB Output is correct
14 Correct 0 ms 12436 KB Output is correct
15 Correct 0 ms 12436 KB Output is correct
16 Correct 0 ms 12436 KB Output is correct
17 Correct 0 ms 12436 KB Output is correct
18 Correct 0 ms 12436 KB Output is correct
19 Correct 0 ms 12436 KB Output is correct
20 Correct 0 ms 12436 KB Output is correct
21 Correct 0 ms 12436 KB Output is correct
22 Correct 0 ms 12436 KB Output is correct
23 Correct 0 ms 12436 KB Output is correct
24 Correct 0 ms 12436 KB Output is correct
25 Correct 0 ms 12436 KB Output is correct
26 Correct 0 ms 12436 KB Output is correct
27 Correct 0 ms 12436 KB Output is correct
28 Correct 0 ms 12436 KB Output is correct
29 Correct 0 ms 12436 KB Output is correct
30 Correct 0 ms 12436 KB Output is correct
31 Correct 0 ms 12436 KB Output is correct
32 Correct 0 ms 12436 KB Output is correct
33 Correct 0 ms 12436 KB Output is correct
34 Correct 0 ms 12436 KB Output is correct
35 Correct 0 ms 12436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 12436 KB Output is correct
2 Correct 0 ms 12436 KB Output is correct
3 Correct 0 ms 12436 KB Output is correct
4 Correct 19 ms 12436 KB Output is correct
5 Incorrect 0 ms 12436 KB Output isn't correct
6 Incorrect 0 ms 12436 KB Output isn't correct
7 Incorrect 0 ms 12436 KB Output isn't correct
8 Correct 0 ms 12436 KB Output is correct
9 Incorrect 0 ms 12436 KB Output isn't correct
10 Incorrect 0 ms 12436 KB Output isn't correct
11 Incorrect 0 ms 12436 KB Output isn't correct
12 Incorrect 0 ms 12436 KB Output isn't correct
13 Incorrect 0 ms 12436 KB Output isn't correct
14 Incorrect 0 ms 12436 KB Output isn't correct
15 Incorrect 0 ms 12436 KB Output isn't correct
16 Incorrect 0 ms 12436 KB Output isn't correct
17 Incorrect 0 ms 12436 KB Output isn't correct
18 Incorrect 0 ms 12436 KB Output isn't correct
19 Incorrect 0 ms 12436 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 12436 KB Output is correct
2 Correct 0 ms 12436 KB Output is correct
3 Correct 0 ms 12436 KB Output is correct
4 Correct 0 ms 12436 KB Output is correct
5 Correct 0 ms 12436 KB Output is correct
6 Correct 0 ms 12436 KB Output is correct
7 Correct 0 ms 12436 KB Output is correct
8 Correct 0 ms 12436 KB Output is correct
9 Correct 0 ms 12436 KB Output is correct
10 Correct 0 ms 12436 KB Output is correct
11 Correct 0 ms 12436 KB Output is correct
12 Correct 0 ms 12436 KB Output is correct
13 Correct 0 ms 12436 KB Output is correct
14 Correct 0 ms 12436 KB Output is correct
15 Correct 0 ms 12436 KB Output is correct
16 Correct 0 ms 12436 KB Output is correct
17 Correct 0 ms 12436 KB Output is correct
18 Correct 0 ms 12436 KB Output is correct
19 Correct 0 ms 12436 KB Output is correct
20 Correct 0 ms 12436 KB Output is correct
21 Correct 0 ms 12436 KB Output is correct
22 Correct 0 ms 12436 KB Output is correct
23 Correct 0 ms 12436 KB Output is correct
24 Correct 0 ms 12436 KB Output is correct
25 Correct 0 ms 12436 KB Output is correct
26 Correct 0 ms 12436 KB Output is correct
27 Correct 0 ms 12436 KB Output is correct
28 Correct 0 ms 12436 KB Output is correct
29 Correct 0 ms 12436 KB Output is correct
30 Correct 0 ms 12436 KB Output is correct
31 Correct 0 ms 12436 KB Output is correct
32 Correct 0 ms 12436 KB Output is correct
33 Correct 0 ms 12436 KB Output is correct
34 Correct 0 ms 12436 KB Output is correct
35 Correct 0 ms 12436 KB Output is correct
36 Correct 69 ms 12436 KB Output is correct
37 Correct 53 ms 12436 KB Output is correct
38 Correct 16 ms 12436 KB Output is correct
39 Correct 3 ms 12436 KB Output is correct
40 Correct 26 ms 12436 KB Output is correct
41 Correct 59 ms 12436 KB Output is correct
42 Correct 66 ms 12436 KB Output is correct
43 Correct 0 ms 12436 KB Output is correct
44 Correct 39 ms 12436 KB Output is correct
45 Correct 0 ms 12436 KB Output is correct
46 Correct 39 ms 12436 KB Output is correct
47 Correct 36 ms 12436 KB Output is correct
48 Correct 33 ms 12436 KB Output is correct
49 Correct 0 ms 12436 KB Output is correct
50 Correct 3 ms 12436 KB Output is correct
51 Correct 3 ms 12436 KB Output is correct
52 Correct 3 ms 12436 KB Output is correct
53 Correct 59 ms 12436 KB Output is correct
54 Correct 13 ms 12436 KB Output is correct
55 Correct 66 ms 12436 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 12436 KB Output is correct
2 Correct 0 ms 12436 KB Output is correct
3 Correct 0 ms 12436 KB Output is correct
4 Correct 0 ms 12436 KB Output is correct
5 Correct 0 ms 12436 KB Output is correct
6 Correct 0 ms 12436 KB Output is correct
7 Correct 0 ms 12436 KB Output is correct
8 Correct 0 ms 12436 KB Output is correct
9 Correct 0 ms 12436 KB Output is correct
10 Correct 0 ms 12436 KB Output is correct
11 Correct 0 ms 12436 KB Output is correct
12 Correct 0 ms 12436 KB Output is correct
13 Correct 0 ms 12436 KB Output is correct
14 Correct 0 ms 12436 KB Output is correct
15 Correct 0 ms 12436 KB Output is correct
16 Correct 0 ms 12436 KB Output is correct
17 Correct 0 ms 12436 KB Output is correct
18 Correct 0 ms 12436 KB Output is correct
19 Correct 0 ms 12436 KB Output is correct
20 Correct 0 ms 12436 KB Output is correct
21 Correct 0 ms 12436 KB Output is correct
22 Correct 0 ms 12436 KB Output is correct
23 Correct 0 ms 12436 KB Output is correct
24 Correct 0 ms 12436 KB Output is correct
25 Correct 0 ms 12436 KB Output is correct
26 Correct 0 ms 12436 KB Output is correct
27 Correct 0 ms 12436 KB Output is correct
28 Correct 0 ms 12436 KB Output is correct
29 Correct 0 ms 12436 KB Output is correct
30 Correct 0 ms 12436 KB Output is correct
31 Correct 0 ms 12436 KB Output is correct
32 Correct 0 ms 12436 KB Output is correct
33 Correct 0 ms 12436 KB Output is correct
34 Correct 0 ms 12436 KB Output is correct
35 Correct 0 ms 12436 KB Output is correct
36 Correct 0 ms 12436 KB Output is correct
37 Correct 0 ms 12436 KB Output is correct
38 Correct 0 ms 12436 KB Output is correct
39 Correct 19 ms 12436 KB Output is correct
40 Incorrect 0 ms 12436 KB Output isn't correct
41 Incorrect 0 ms 12436 KB Output isn't correct
42 Incorrect 0 ms 12436 KB Output isn't correct
43 Correct 0 ms 12436 KB Output is correct
44 Incorrect 0 ms 12436 KB Output isn't correct
45 Incorrect 0 ms 12436 KB Output isn't correct
46 Incorrect 0 ms 12436 KB Output isn't correct
47 Incorrect 0 ms 12436 KB Output isn't correct
48 Incorrect 0 ms 12436 KB Output isn't correct
49 Incorrect 0 ms 12436 KB Output isn't correct
50 Incorrect 0 ms 12436 KB Output isn't correct
51 Incorrect 0 ms 12436 KB Output isn't correct
52 Incorrect 0 ms 12436 KB Output isn't correct
53 Incorrect 0 ms 12436 KB Output isn't correct
54 Incorrect 0 ms 12436 KB Output isn't correct
55 Correct 69 ms 12436 KB Output is correct
56 Correct 53 ms 12436 KB Output is correct
57 Correct 16 ms 12436 KB Output is correct
58 Correct 3 ms 12436 KB Output is correct
59 Correct 26 ms 12436 KB Output is correct
60 Correct 59 ms 12436 KB Output is correct
61 Correct 66 ms 12436 KB Output is correct
62 Correct 0 ms 12436 KB Output is correct
63 Correct 39 ms 12436 KB Output is correct
64 Correct 0 ms 12436 KB Output is correct
65 Correct 39 ms 12436 KB Output is correct
66 Correct 36 ms 12436 KB Output is correct
67 Correct 33 ms 12436 KB Output is correct
68 Correct 0 ms 12436 KB Output is correct
69 Correct 3 ms 12436 KB Output is correct
70 Correct 3 ms 12436 KB Output is correct
71 Correct 3 ms 12436 KB Output is correct
72 Correct 59 ms 12436 KB Output is correct
73 Correct 13 ms 12436 KB Output is correct
74 Correct 66 ms 12436 KB Output is correct
75 Incorrect 0 ms 12436 KB Output isn't correct
76 Incorrect 0 ms 12436 KB Output isn't correct
77 Incorrect 0 ms 12436 KB Output isn't correct
78 Incorrect 0 ms 12436 KB Output isn't correct
79 Incorrect 0 ms 12436 KB Output isn't correct
80 Incorrect 0 ms 12436 KB Output isn't correct
81 Incorrect 0 ms 12436 KB Output isn't correct
82 Incorrect 0 ms 12436 KB Output isn't correct
83 Incorrect 0 ms 12436 KB Output isn't correct
84 Incorrect 0 ms 12436 KB Output isn't correct
85 Incorrect 0 ms 12436 KB Output isn't correct
86 Incorrect 0 ms 12436 KB Output isn't correct
87 Incorrect 0 ms 12436 KB Output isn't correct
88 Incorrect 0 ms 12436 KB Output isn't correct
89 Incorrect 0 ms 12436 KB Output isn't correct
90 Incorrect 0 ms 12436 KB Output isn't correct
91 Incorrect 0 ms 12436 KB Output isn't correct
92 Incorrect 0 ms 12436 KB Output isn't correct
93 Incorrect 0 ms 12436 KB Output isn't correct
94 Incorrect 0 ms 12436 KB Output isn't correct
95 Incorrect 0 ms 12436 KB Output isn't correct