답안 #20484

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
20484 2017-02-12T04:23:48 Z 볼빨간민돌이(#63, mindol) 초음속철도 (OJUZ11_rail) C++11
18 / 100
449 ms 1340 KB
#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;

const int MAXM = 20;
const int mod = 1e9+7;
int n, m, s[MAXM+1], e[MAXM+1];

bool use[MAXM+1];

int check(){
	vector<pair<int,int>> v;

    for(int i=1; i<=m; i++)
		if(use[i]) v.push_back(make_pair(s[i], e[i]));
    sort(v.begin(), v.end());
    if(v.empty()) return 0;

    int now=1;
    for(auto &e:v){
		if(e.first > now) break;
		else now=max(now, e.second);
    }
    return now==n;
}

int f(int now){
	if(now==m+1) return check();

	int sum=0;
	use[now]=true;
	sum+=f(now+1);
	use[now]=false;
	sum+=f(now+1);
	return sum;
}

int main(){
	scanf("%d %d", &n, &m);
    for(int i=1; i<=m; i++)
		scanf("%d %d", &s[i], &e[i]);
    printf("%d", f(1));
	return 0;
}

Compilation message

rail.cpp: In function 'int main()':
rail.cpp:40:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &m);
                        ^
rail.cpp:42:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d %d", &s[i], &e[i]);
                               ^
# 결과 실행 시간 메모리 Grader output
1 Correct 366 ms 1176 KB Output is correct
2 Correct 199 ms 1176 KB Output is correct
3 Correct 399 ms 1176 KB Output is correct
4 Correct 419 ms 1176 KB Output is correct
5 Correct 0 ms 1176 KB Output is correct
6 Correct 0 ms 1176 KB Output is correct
7 Correct 413 ms 1176 KB Output is correct
8 Correct 46 ms 1176 KB Output is correct
9 Correct 0 ms 1176 KB Output is correct
10 Correct 0 ms 1176 KB Output is correct
11 Correct 0 ms 1176 KB Output is correct
12 Correct 203 ms 1176 KB Output is correct
13 Correct 359 ms 1176 KB Output is correct
14 Correct 179 ms 1176 KB Output is correct
15 Correct 449 ms 1176 KB Output is correct
16 Correct 433 ms 1176 KB Output is correct
17 Correct 433 ms 1176 KB Output is correct
18 Correct 419 ms 1176 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 366 ms 1176 KB Output is correct
2 Correct 199 ms 1176 KB Output is correct
3 Correct 399 ms 1176 KB Output is correct
4 Correct 419 ms 1176 KB Output is correct
5 Correct 0 ms 1176 KB Output is correct
6 Correct 0 ms 1176 KB Output is correct
7 Correct 413 ms 1176 KB Output is correct
8 Correct 46 ms 1176 KB Output is correct
9 Correct 0 ms 1176 KB Output is correct
10 Correct 0 ms 1176 KB Output is correct
11 Correct 0 ms 1176 KB Output is correct
12 Correct 203 ms 1176 KB Output is correct
13 Correct 359 ms 1176 KB Output is correct
14 Correct 179 ms 1176 KB Output is correct
15 Correct 449 ms 1176 KB Output is correct
16 Correct 433 ms 1176 KB Output is correct
17 Correct 433 ms 1176 KB Output is correct
18 Correct 419 ms 1176 KB Output is correct
19 Correct 419 ms 1176 KB Output is correct
20 Correct 433 ms 1176 KB Output is correct
21 Correct 403 ms 1176 KB Output is correct
22 Correct 106 ms 1176 KB Output is correct
23 Correct 0 ms 1176 KB Output is correct
24 Correct 99 ms 1176 KB Output is correct
25 Correct 96 ms 1176 KB Output is correct
26 Correct 99 ms 1176 KB Output is correct
27 Correct 403 ms 1176 KB Output is correct
28 Correct 373 ms 1176 KB Output is correct
29 Correct 426 ms 1176 KB Output is correct
30 Correct 403 ms 1176 KB Output is correct
31 Correct 406 ms 1176 KB Output is correct
32 Correct 196 ms 1176 KB Output is correct
33 Correct 386 ms 1176 KB Output is correct
34 Correct 349 ms 1176 KB Output is correct
35 Correct 393 ms 1176 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 1176 KB Output is correct
2 Correct 0 ms 1176 KB Output is correct
3 Correct 0 ms 1176 KB Output is correct
4 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
5 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
6 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
7 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
8 Runtime error 0 ms 1336 KB Execution killed with signal 11 (could be triggered by violating memory limits)
9 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
10 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
11 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
12 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
13 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
14 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
15 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
16 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
17 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
18 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
19 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
# 결과 실행 시간 메모리 Grader output
1 Correct 366 ms 1176 KB Output is correct
2 Correct 199 ms 1176 KB Output is correct
3 Correct 399 ms 1176 KB Output is correct
4 Correct 419 ms 1176 KB Output is correct
5 Correct 0 ms 1176 KB Output is correct
6 Correct 0 ms 1176 KB Output is correct
7 Correct 413 ms 1176 KB Output is correct
8 Correct 46 ms 1176 KB Output is correct
9 Correct 0 ms 1176 KB Output is correct
10 Correct 0 ms 1176 KB Output is correct
11 Correct 0 ms 1176 KB Output is correct
12 Correct 203 ms 1176 KB Output is correct
13 Correct 359 ms 1176 KB Output is correct
14 Correct 179 ms 1176 KB Output is correct
15 Correct 449 ms 1176 KB Output is correct
16 Correct 433 ms 1176 KB Output is correct
17 Correct 433 ms 1176 KB Output is correct
18 Correct 419 ms 1176 KB Output is correct
19 Correct 419 ms 1176 KB Output is correct
20 Correct 433 ms 1176 KB Output is correct
21 Correct 403 ms 1176 KB Output is correct
22 Correct 106 ms 1176 KB Output is correct
23 Correct 0 ms 1176 KB Output is correct
24 Correct 99 ms 1176 KB Output is correct
25 Correct 96 ms 1176 KB Output is correct
26 Correct 99 ms 1176 KB Output is correct
27 Correct 403 ms 1176 KB Output is correct
28 Correct 373 ms 1176 KB Output is correct
29 Correct 426 ms 1176 KB Output is correct
30 Correct 403 ms 1176 KB Output is correct
31 Correct 406 ms 1176 KB Output is correct
32 Correct 196 ms 1176 KB Output is correct
33 Correct 386 ms 1176 KB Output is correct
34 Correct 349 ms 1176 KB Output is correct
35 Correct 393 ms 1176 KB Output is correct
36 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
37 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
38 Runtime error 0 ms 1340 KB Execution killed with signal 11 (could be triggered by violating memory limits)
39 Incorrect 0 ms 1176 KB Output isn't correct
40 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
41 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
42 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
43 Incorrect 0 ms 1176 KB Output isn't correct
44 Incorrect 0 ms 1176 KB Output isn't correct
45 Incorrect 0 ms 1176 KB Output isn't correct
46 Incorrect 0 ms 1176 KB Output isn't correct
47 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
48 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
49 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
50 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
51 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
52 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
53 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
54 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
55 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
# 결과 실행 시간 메모리 Grader output
1 Correct 366 ms 1176 KB Output is correct
2 Correct 199 ms 1176 KB Output is correct
3 Correct 399 ms 1176 KB Output is correct
4 Correct 419 ms 1176 KB Output is correct
5 Correct 0 ms 1176 KB Output is correct
6 Correct 0 ms 1176 KB Output is correct
7 Correct 413 ms 1176 KB Output is correct
8 Correct 46 ms 1176 KB Output is correct
9 Correct 0 ms 1176 KB Output is correct
10 Correct 0 ms 1176 KB Output is correct
11 Correct 0 ms 1176 KB Output is correct
12 Correct 203 ms 1176 KB Output is correct
13 Correct 359 ms 1176 KB Output is correct
14 Correct 179 ms 1176 KB Output is correct
15 Correct 449 ms 1176 KB Output is correct
16 Correct 433 ms 1176 KB Output is correct
17 Correct 433 ms 1176 KB Output is correct
18 Correct 419 ms 1176 KB Output is correct
19 Correct 419 ms 1176 KB Output is correct
20 Correct 433 ms 1176 KB Output is correct
21 Correct 403 ms 1176 KB Output is correct
22 Correct 106 ms 1176 KB Output is correct
23 Correct 0 ms 1176 KB Output is correct
24 Correct 99 ms 1176 KB Output is correct
25 Correct 96 ms 1176 KB Output is correct
26 Correct 99 ms 1176 KB Output is correct
27 Correct 403 ms 1176 KB Output is correct
28 Correct 373 ms 1176 KB Output is correct
29 Correct 426 ms 1176 KB Output is correct
30 Correct 403 ms 1176 KB Output is correct
31 Correct 406 ms 1176 KB Output is correct
32 Correct 196 ms 1176 KB Output is correct
33 Correct 386 ms 1176 KB Output is correct
34 Correct 349 ms 1176 KB Output is correct
35 Correct 393 ms 1176 KB Output is correct
36 Correct 0 ms 1176 KB Output is correct
37 Correct 0 ms 1176 KB Output is correct
38 Correct 0 ms 1176 KB Output is correct
39 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
40 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
41 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
42 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
43 Runtime error 0 ms 1336 KB Execution killed with signal 11 (could be triggered by violating memory limits)
44 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
45 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
46 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
47 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
48 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
49 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
50 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
51 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
52 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
53 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
54 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
55 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
56 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
57 Runtime error 0 ms 1340 KB Execution killed with signal 11 (could be triggered by violating memory limits)
58 Incorrect 0 ms 1176 KB Output isn't correct
59 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
60 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
61 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
62 Incorrect 0 ms 1176 KB Output isn't correct
63 Incorrect 0 ms 1176 KB Output isn't correct
64 Incorrect 0 ms 1176 KB Output isn't correct
65 Incorrect 0 ms 1176 KB Output isn't correct
66 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
67 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
68 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
69 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
70 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
71 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
72 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
73 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
74 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
75 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
76 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
77 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
78 Incorrect 0 ms 1176 KB Output isn't correct
79 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
80 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
81 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
82 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
83 Incorrect 0 ms 1176 KB Output isn't correct
84 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
85 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
86 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
87 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
88 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
89 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
90 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
91 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
92 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
93 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
94 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)
95 Runtime error 0 ms 1176 KB Execution killed because of forbidden syscall futex (202)