답안 #763483

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
763483 2023-06-22T11:16:23 Z vjudge1 Just Long Neckties (JOI20_ho_t1) C++17
9 / 100
77 ms 11176 KB
#include<bits/stdc++.h>
using namespace std;

int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n, maxx = 0, dp[200001], save[200001];
	pair<int, int> pa[200001];
	cin >> n;
	for(int i = 1; i <= n + 1; i++)
	{
		cin >> pa[i].first;
		pa[i].second = i;
	}
	for(int i = 1; i <= n; i++)
	{
		cin >> dp[i];
	}
	sort(dp + 1, dp + n + 1);
	sort(pa + 1, pa + n + 2);
	for(int i = 1; i <= n; i++)
	{
		maxx = max(maxx, max(pa[i].first - dp[i], 0));
	}
	save[pa[n + 1].second] = maxx;
	for(int i = n; i >= 1; i--)
	{
		maxx = max(maxx, max(pa[i + 1].first - dp[i], 0));
		save[pa[i].second] = maxx;
	}
	for(int i = 1; i <= n + 1; i++)	
	{
		cout << save[i] << " ";
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3412 KB Output is correct
2 Correct 2 ms 3444 KB Output is correct
3 Correct 2 ms 3412 KB Output is correct
4 Correct 2 ms 3412 KB Output is correct
5 Correct 2 ms 3448 KB Output is correct
6 Correct 2 ms 3448 KB Output is correct
7 Correct 2 ms 3412 KB Output is correct
8 Correct 2 ms 3412 KB Output is correct
9 Correct 2 ms 3412 KB Output is correct
10 Correct 2 ms 3412 KB Output is correct
11 Correct 2 ms 3448 KB Output is correct
12 Correct 2 ms 3412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3412 KB Output is correct
2 Correct 2 ms 3444 KB Output is correct
3 Correct 2 ms 3412 KB Output is correct
4 Correct 2 ms 3412 KB Output is correct
5 Correct 2 ms 3448 KB Output is correct
6 Correct 2 ms 3448 KB Output is correct
7 Correct 2 ms 3412 KB Output is correct
8 Correct 2 ms 3412 KB Output is correct
9 Correct 2 ms 3412 KB Output is correct
10 Correct 2 ms 3412 KB Output is correct
11 Correct 2 ms 3448 KB Output is correct
12 Correct 2 ms 3412 KB Output is correct
13 Correct 2 ms 3412 KB Output is correct
14 Correct 2 ms 3412 KB Output is correct
15 Correct 2 ms 3460 KB Output is correct
16 Correct 2 ms 3540 KB Output is correct
17 Correct 2 ms 3412 KB Output is correct
18 Correct 2 ms 3460 KB Output is correct
19 Correct 2 ms 3412 KB Output is correct
20 Correct 2 ms 3456 KB Output is correct
21 Correct 2 ms 3412 KB Output is correct
22 Correct 2 ms 3412 KB Output is correct
23 Correct 2 ms 3412 KB Output is correct
24 Correct 2 ms 3460 KB Output is correct
25 Correct 2 ms 3484 KB Output is correct
26 Correct 3 ms 3484 KB Output is correct
27 Correct 2 ms 3412 KB Output is correct
28 Correct 2 ms 3412 KB Output is correct
29 Correct 3 ms 3412 KB Output is correct
30 Correct 2 ms 3456 KB Output is correct
31 Correct 2 ms 3464 KB Output is correct
32 Correct 3 ms 3412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 3412 KB Output is correct
2 Correct 2 ms 3444 KB Output is correct
3 Correct 2 ms 3412 KB Output is correct
4 Correct 2 ms 3412 KB Output is correct
5 Correct 2 ms 3448 KB Output is correct
6 Correct 2 ms 3448 KB Output is correct
7 Correct 2 ms 3412 KB Output is correct
8 Correct 2 ms 3412 KB Output is correct
9 Correct 2 ms 3412 KB Output is correct
10 Correct 2 ms 3412 KB Output is correct
11 Correct 2 ms 3448 KB Output is correct
12 Correct 2 ms 3412 KB Output is correct
13 Correct 2 ms 3412 KB Output is correct
14 Correct 2 ms 3412 KB Output is correct
15 Correct 2 ms 3460 KB Output is correct
16 Correct 2 ms 3540 KB Output is correct
17 Correct 2 ms 3412 KB Output is correct
18 Correct 2 ms 3460 KB Output is correct
19 Correct 2 ms 3412 KB Output is correct
20 Correct 2 ms 3456 KB Output is correct
21 Correct 2 ms 3412 KB Output is correct
22 Correct 2 ms 3412 KB Output is correct
23 Correct 2 ms 3412 KB Output is correct
24 Correct 2 ms 3460 KB Output is correct
25 Correct 2 ms 3484 KB Output is correct
26 Correct 3 ms 3484 KB Output is correct
27 Correct 2 ms 3412 KB Output is correct
28 Correct 2 ms 3412 KB Output is correct
29 Correct 3 ms 3412 KB Output is correct
30 Correct 2 ms 3456 KB Output is correct
31 Correct 2 ms 3464 KB Output is correct
32 Correct 3 ms 3412 KB Output is correct
33 Correct 74 ms 8528 KB Output is correct
34 Correct 68 ms 8800 KB Output is correct
35 Correct 76 ms 8652 KB Output is correct
36 Correct 68 ms 9060 KB Output is correct
37 Correct 71 ms 9168 KB Output is correct
38 Correct 68 ms 9152 KB Output is correct
39 Correct 67 ms 8284 KB Output is correct
40 Correct 67 ms 8280 KB Output is correct
41 Correct 72 ms 8364 KB Output is correct
42 Correct 66 ms 8284 KB Output is correct
43 Correct 66 ms 8288 KB Output is correct
44 Correct 64 ms 7968 KB Output is correct
45 Correct 77 ms 8012 KB Output is correct
46 Correct 65 ms 7888 KB Output is correct
47 Runtime error 68 ms 11176 KB Execution killed with signal 6
48 Halted 0 ms 0 KB -