Submission #66254

# Submission time Handle Problem Language Result Execution time Memory
66254 2018-08-10T05:48:33 Z 김세빈(#1887) 초음속철도 (OJUZ11_rail) C++11
45 / 100
146 ms 1148 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair <ll, ll> pll;

const ll mod = 1e9 + 7;

pll P[5050];
vector <ll> X;
ll D[10101];
ll n, m;

int main()
{
	ll i, j, s, e;
	
	scanf("%lld%lld", &n, &m);
	
	if(m > 5000) return 0;
	
	X.push_back(1); X.push_back(n);
	
	for(i=1; i<=m; i++){
		scanf("%lld%lld", &s, &e);
		P[i] = pll(e, s);
		X.push_back(s); X.push_back(e);
	}
	
	sort(X.begin(), X.end());
	X.erase(unique(X.begin(), X.end()), X.end());
	
	n = lower_bound(X.begin(), X.end(), n) - X.begin();
	
	sort(P + 1, P + m + 1);
	
	D[0] = 1;
	
	for(i=1; i<=m; i++){
		e = lower_bound(X.begin(), X.end(), P[i].first) - X.begin();
		s = lower_bound(X.begin(), X.end(), P[i].second) - X.begin();
		for(j=0; j<s; j++) D[j] = (D[j] * 2) % mod;
		for(j=e; j>=s; j--) D[e] = (D[e] + D[j]) % mod;
	}
	
	printf("%lld\n", D[n]);
	
	return 0;
}

Compilation message

rail.cpp: In function 'int main()':
rail.cpp:19:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld%lld", &n, &m);
  ~~~~~^~~~~~~~~~~~~~~~~~~~
rail.cpp:26:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%lld%lld", &s, &e);
   ~~~~~^~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Correct 2 ms 488 KB Output is correct
4 Correct 2 ms 488 KB Output is correct
5 Correct 3 ms 488 KB Output is correct
6 Correct 2 ms 560 KB Output is correct
7 Correct 2 ms 560 KB Output is correct
8 Correct 2 ms 560 KB Output is correct
9 Correct 2 ms 560 KB Output is correct
10 Correct 2 ms 560 KB Output is correct
11 Correct 2 ms 560 KB Output is correct
12 Correct 2 ms 560 KB Output is correct
13 Correct 2 ms 560 KB Output is correct
14 Correct 2 ms 584 KB Output is correct
15 Correct 2 ms 584 KB Output is correct
16 Correct 2 ms 600 KB Output is correct
17 Correct 2 ms 600 KB Output is correct
18 Correct 2 ms 612 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Correct 2 ms 488 KB Output is correct
4 Correct 2 ms 488 KB Output is correct
5 Correct 3 ms 488 KB Output is correct
6 Correct 2 ms 560 KB Output is correct
7 Correct 2 ms 560 KB Output is correct
8 Correct 2 ms 560 KB Output is correct
9 Correct 2 ms 560 KB Output is correct
10 Correct 2 ms 560 KB Output is correct
11 Correct 2 ms 560 KB Output is correct
12 Correct 2 ms 560 KB Output is correct
13 Correct 2 ms 560 KB Output is correct
14 Correct 2 ms 584 KB Output is correct
15 Correct 2 ms 584 KB Output is correct
16 Correct 2 ms 600 KB Output is correct
17 Correct 2 ms 600 KB Output is correct
18 Correct 2 ms 612 KB Output is correct
19 Correct 2 ms 612 KB Output is correct
20 Correct 2 ms 612 KB Output is correct
21 Correct 2 ms 620 KB Output is correct
22 Correct 2 ms 620 KB Output is correct
23 Correct 2 ms 620 KB Output is correct
24 Correct 2 ms 620 KB Output is correct
25 Correct 3 ms 620 KB Output is correct
26 Correct 2 ms 620 KB Output is correct
27 Correct 2 ms 620 KB Output is correct
28 Correct 2 ms 620 KB Output is correct
29 Correct 2 ms 644 KB Output is correct
30 Correct 2 ms 644 KB Output is correct
31 Correct 2 ms 644 KB Output is correct
32 Correct 2 ms 644 KB Output is correct
33 Correct 2 ms 644 KB Output is correct
34 Correct 2 ms 644 KB Output is correct
35 Correct 2 ms 644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 644 KB Output is correct
2 Correct 2 ms 644 KB Output is correct
3 Correct 2 ms 644 KB Output is correct
4 Correct 23 ms 892 KB Output is correct
5 Incorrect 2 ms 892 KB Output isn't correct
6 Incorrect 2 ms 892 KB Output isn't correct
7 Incorrect 2 ms 892 KB Output isn't correct
8 Correct 2 ms 892 KB Output is correct
9 Incorrect 2 ms 892 KB Output isn't correct
10 Incorrect 2 ms 892 KB Output isn't correct
11 Incorrect 2 ms 892 KB Output isn't correct
12 Incorrect 2 ms 892 KB Output isn't correct
13 Incorrect 2 ms 892 KB Output isn't correct
14 Incorrect 2 ms 892 KB Output isn't correct
15 Incorrect 2 ms 892 KB Output isn't correct
16 Incorrect 2 ms 892 KB Output isn't correct
17 Incorrect 2 ms 892 KB Output isn't correct
18 Incorrect 2 ms 892 KB Output isn't correct
19 Incorrect 2 ms 892 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Correct 2 ms 488 KB Output is correct
4 Correct 2 ms 488 KB Output is correct
5 Correct 3 ms 488 KB Output is correct
6 Correct 2 ms 560 KB Output is correct
7 Correct 2 ms 560 KB Output is correct
8 Correct 2 ms 560 KB Output is correct
9 Correct 2 ms 560 KB Output is correct
10 Correct 2 ms 560 KB Output is correct
11 Correct 2 ms 560 KB Output is correct
12 Correct 2 ms 560 KB Output is correct
13 Correct 2 ms 560 KB Output is correct
14 Correct 2 ms 584 KB Output is correct
15 Correct 2 ms 584 KB Output is correct
16 Correct 2 ms 600 KB Output is correct
17 Correct 2 ms 600 KB Output is correct
18 Correct 2 ms 612 KB Output is correct
19 Correct 2 ms 612 KB Output is correct
20 Correct 2 ms 612 KB Output is correct
21 Correct 2 ms 620 KB Output is correct
22 Correct 2 ms 620 KB Output is correct
23 Correct 2 ms 620 KB Output is correct
24 Correct 2 ms 620 KB Output is correct
25 Correct 3 ms 620 KB Output is correct
26 Correct 2 ms 620 KB Output is correct
27 Correct 2 ms 620 KB Output is correct
28 Correct 2 ms 620 KB Output is correct
29 Correct 2 ms 644 KB Output is correct
30 Correct 2 ms 644 KB Output is correct
31 Correct 2 ms 644 KB Output is correct
32 Correct 2 ms 644 KB Output is correct
33 Correct 2 ms 644 KB Output is correct
34 Correct 2 ms 644 KB Output is correct
35 Correct 2 ms 644 KB Output is correct
36 Correct 132 ms 1052 KB Output is correct
37 Correct 89 ms 1052 KB Output is correct
38 Correct 34 ms 1052 KB Output is correct
39 Correct 4 ms 1052 KB Output is correct
40 Correct 31 ms 1052 KB Output is correct
41 Correct 109 ms 1052 KB Output is correct
42 Correct 136 ms 1060 KB Output is correct
43 Correct 2 ms 1060 KB Output is correct
44 Correct 95 ms 1060 KB Output is correct
45 Correct 6 ms 1060 KB Output is correct
46 Correct 85 ms 1060 KB Output is correct
47 Correct 67 ms 1060 KB Output is correct
48 Correct 78 ms 1060 KB Output is correct
49 Correct 8 ms 1060 KB Output is correct
50 Correct 7 ms 1060 KB Output is correct
51 Correct 5 ms 1060 KB Output is correct
52 Correct 9 ms 1060 KB Output is correct
53 Correct 110 ms 1148 KB Output is correct
54 Correct 29 ms 1148 KB Output is correct
55 Correct 146 ms 1148 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 488 KB Output is correct
3 Correct 2 ms 488 KB Output is correct
4 Correct 2 ms 488 KB Output is correct
5 Correct 3 ms 488 KB Output is correct
6 Correct 2 ms 560 KB Output is correct
7 Correct 2 ms 560 KB Output is correct
8 Correct 2 ms 560 KB Output is correct
9 Correct 2 ms 560 KB Output is correct
10 Correct 2 ms 560 KB Output is correct
11 Correct 2 ms 560 KB Output is correct
12 Correct 2 ms 560 KB Output is correct
13 Correct 2 ms 560 KB Output is correct
14 Correct 2 ms 584 KB Output is correct
15 Correct 2 ms 584 KB Output is correct
16 Correct 2 ms 600 KB Output is correct
17 Correct 2 ms 600 KB Output is correct
18 Correct 2 ms 612 KB Output is correct
19 Correct 2 ms 612 KB Output is correct
20 Correct 2 ms 612 KB Output is correct
21 Correct 2 ms 620 KB Output is correct
22 Correct 2 ms 620 KB Output is correct
23 Correct 2 ms 620 KB Output is correct
24 Correct 2 ms 620 KB Output is correct
25 Correct 3 ms 620 KB Output is correct
26 Correct 2 ms 620 KB Output is correct
27 Correct 2 ms 620 KB Output is correct
28 Correct 2 ms 620 KB Output is correct
29 Correct 2 ms 644 KB Output is correct
30 Correct 2 ms 644 KB Output is correct
31 Correct 2 ms 644 KB Output is correct
32 Correct 2 ms 644 KB Output is correct
33 Correct 2 ms 644 KB Output is correct
34 Correct 2 ms 644 KB Output is correct
35 Correct 2 ms 644 KB Output is correct
36 Correct 2 ms 644 KB Output is correct
37 Correct 2 ms 644 KB Output is correct
38 Correct 2 ms 644 KB Output is correct
39 Correct 23 ms 892 KB Output is correct
40 Incorrect 2 ms 892 KB Output isn't correct
41 Incorrect 2 ms 892 KB Output isn't correct
42 Incorrect 2 ms 892 KB Output isn't correct
43 Correct 2 ms 892 KB Output is correct
44 Incorrect 2 ms 892 KB Output isn't correct
45 Incorrect 2 ms 892 KB Output isn't correct
46 Incorrect 2 ms 892 KB Output isn't correct
47 Incorrect 2 ms 892 KB Output isn't correct
48 Incorrect 2 ms 892 KB Output isn't correct
49 Incorrect 2 ms 892 KB Output isn't correct
50 Incorrect 2 ms 892 KB Output isn't correct
51 Incorrect 2 ms 892 KB Output isn't correct
52 Incorrect 2 ms 892 KB Output isn't correct
53 Incorrect 2 ms 892 KB Output isn't correct
54 Incorrect 2 ms 892 KB Output isn't correct
55 Correct 132 ms 1052 KB Output is correct
56 Correct 89 ms 1052 KB Output is correct
57 Correct 34 ms 1052 KB Output is correct
58 Correct 4 ms 1052 KB Output is correct
59 Correct 31 ms 1052 KB Output is correct
60 Correct 109 ms 1052 KB Output is correct
61 Correct 136 ms 1060 KB Output is correct
62 Correct 2 ms 1060 KB Output is correct
63 Correct 95 ms 1060 KB Output is correct
64 Correct 6 ms 1060 KB Output is correct
65 Correct 85 ms 1060 KB Output is correct
66 Correct 67 ms 1060 KB Output is correct
67 Correct 78 ms 1060 KB Output is correct
68 Correct 8 ms 1060 KB Output is correct
69 Correct 7 ms 1060 KB Output is correct
70 Correct 5 ms 1060 KB Output is correct
71 Correct 9 ms 1060 KB Output is correct
72 Correct 110 ms 1148 KB Output is correct
73 Correct 29 ms 1148 KB Output is correct
74 Correct 146 ms 1148 KB Output is correct
75 Incorrect 2 ms 1148 KB Output isn't correct
76 Incorrect 2 ms 1148 KB Output isn't correct
77 Incorrect 2 ms 1148 KB Output isn't correct
78 Incorrect 2 ms 1148 KB Output isn't correct
79 Incorrect 2 ms 1148 KB Output isn't correct
80 Incorrect 2 ms 1148 KB Output isn't correct
81 Incorrect 2 ms 1148 KB Output isn't correct
82 Incorrect 3 ms 1148 KB Output isn't correct
83 Incorrect 2 ms 1148 KB Output isn't correct
84 Incorrect 2 ms 1148 KB Output isn't correct
85 Incorrect 2 ms 1148 KB Output isn't correct
86 Incorrect 2 ms 1148 KB Output isn't correct
87 Incorrect 2 ms 1148 KB Output isn't correct
88 Incorrect 2 ms 1148 KB Output isn't correct
89 Incorrect 2 ms 1148 KB Output isn't correct
90 Incorrect 3 ms 1148 KB Output isn't correct
91 Incorrect 3 ms 1148 KB Output isn't correct
92 Incorrect 2 ms 1148 KB Output isn't correct
93 Incorrect 3 ms 1148 KB Output isn't correct
94 Incorrect 2 ms 1148 KB Output isn't correct
95 Incorrect 2 ms 1148 KB Output isn't correct