답안 #260200

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
260200 2020-08-09T17:43:24 Z cheissmart Just Long Neckties (JOI20_ho_t1) C++14
100 / 100
144 ms 10872 KB
#include <bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define MP make_pair
#define ALL(v) (v).begin(), (v).end()
#define debug(x) cerr << #x << " " << (x) << endl;
#define V vector

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef V<int> vi;

int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	
	int n;
	cin >> n;
	V<pi> a(n+2);
	for(int i = 1; i <= n + 1; i++) {
		cin >> a[i].F;
		a[i].S = i;
	}
	sort(ALL(a));
	vi b(n+1), l(n+3), r(n+3), ans(n+2);
	for(int i = 1; i <= n; i++) cin >> b[i];
	sort(ALL(b));
	for(int i = 1; i <= n + 1; i++) l[i] = max(l[i-1], a[i].F-b[i]);
	for(int i = n + 1; i >= 2; i--) r[i] = max(r[i+1], a[i].F-b[i-1]);
	for(int i = 1; i <= n + 1; i++) {
		ans[a[i].S] = max(l[i-1], r[i+1]);
	}
	for(int i = 1; i <= n + 1; i++) cout << ans[i] << " ";
	cout << endl;
	
	
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 0 ms 384 KB Output is correct
12 Correct 0 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 0 ms 384 KB Output is correct
12 Correct 0 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 2 ms 512 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 2 ms 384 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 0 ms 384 KB Output is correct
6 Correct 0 ms 384 KB Output is correct
7 Correct 0 ms 384 KB Output is correct
8 Correct 0 ms 384 KB Output is correct
9 Correct 1 ms 384 KB Output is correct
10 Correct 0 ms 384 KB Output is correct
11 Correct 0 ms 384 KB Output is correct
12 Correct 0 ms 384 KB Output is correct
13 Correct 1 ms 384 KB Output is correct
14 Correct 1 ms 384 KB Output is correct
15 Correct 1 ms 384 KB Output is correct
16 Correct 1 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 1 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 2 ms 384 KB Output is correct
23 Correct 1 ms 384 KB Output is correct
24 Correct 1 ms 384 KB Output is correct
25 Correct 2 ms 512 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 1 ms 384 KB Output is correct
30 Correct 2 ms 384 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 136 ms 9976 KB Output is correct
34 Correct 144 ms 10488 KB Output is correct
35 Correct 137 ms 10104 KB Output is correct
36 Correct 135 ms 10616 KB Output is correct
37 Correct 140 ms 10872 KB Output is correct
38 Correct 143 ms 10744 KB Output is correct
39 Correct 134 ms 9848 KB Output is correct
40 Correct 128 ms 9852 KB Output is correct
41 Correct 134 ms 10088 KB Output is correct
42 Correct 134 ms 9848 KB Output is correct
43 Correct 136 ms 9976 KB Output is correct
44 Correct 129 ms 9592 KB Output is correct
45 Correct 126 ms 9464 KB Output is correct
46 Correct 128 ms 9336 KB Output is correct
47 Correct 116 ms 9592 KB Output is correct
48 Correct 120 ms 9592 KB Output is correct
49 Correct 130 ms 10104 KB Output is correct
50 Correct 134 ms 10096 KB Output is correct
51 Correct 136 ms 10152 KB Output is correct
52 Correct 129 ms 10104 KB Output is correct
53 Correct 131 ms 10136 KB Output is correct