답안 #20675

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
20675 2017-02-13T13:23:15 Z Kwiyomi Express(#82, ainu7) Can polan into space? (OJUZ11_space) C++
0 / 100
183 ms 24720 KB
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <string>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
#include <iostream>
#include <sstream>
#include <set>
using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<vector<long long> > cost(n+1, vector<long long>(2));
	vector<vector<long long> > from(n, vector<long long>(2));
	// 0 : me fly early, 1 : me fly late
	cost[0][1] = 0;
	cost[0][0] = -9999999999999999LL;
	for (int i=0; i<n; i++) {
		int a, b, c;
		scanf("%d %d %d", &a, &b, &c);
		cost[i+1][0] = max(cost[i][0] + b, cost[i][1] + a);
		cost[i+1][1] = max(cost[i][0] + c, cost[i][1] + b);
		from[i][0] = (cost[i+1][0] == cost[i][1] + a);
		from[i][1] = (cost[i+1][1] == cost[i][1] + b);
	}
	printf("%lld\n", cost[n][0]);

	vector<int> res(n);
	int idx = 1;
	int ll = 0, rr = 0;
	res[n-1] = 0;
	for (int i=n-1; i>=1; i--) {
		if (from[i][idx] == 1) {
			ll --;
			res[i-1] = ll;
		} else {
			rr ++;
			res[i-1] = rr;
		}
	}
	for (int i=0; i<n; i++)
		printf("%d ", res[i]-ll+1);
	printf("\n");
}

Compilation message

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