답안 #763490

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
763490 2023-06-22T11:23:41 Z vjudge1 Just Long Neckties (JOI20_ho_t1) C++17
100 / 100
84 ms 8488 KB
#include<bits/stdc++.h>
using namespace std;
int n, maxx = 0, dp[200001], save[200001];
	pair<int, int> pa[200001];
int main()
{
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	
	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 1 ms 328 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 2 ms 344 KB Output is correct
19 Correct 1 ms 368 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 360 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 360 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 324 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 340 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 340 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 1 ms 340 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 1 ms 336 KB Output is correct
18 Correct 2 ms 344 KB Output is correct
19 Correct 1 ms 368 KB Output is correct
20 Correct 1 ms 340 KB Output is correct
21 Correct 1 ms 360 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 360 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 340 KB Output is correct
31 Correct 1 ms 340 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 67 ms 5084 KB Output is correct
34 Correct 69 ms 5264 KB Output is correct
35 Correct 68 ms 4992 KB Output is correct
36 Correct 68 ms 5528 KB Output is correct
37 Correct 69 ms 5592 KB Output is correct
38 Correct 84 ms 5572 KB Output is correct
39 Correct 67 ms 4772 KB Output is correct
40 Correct 67 ms 4704 KB Output is correct
41 Correct 75 ms 4736 KB Output is correct
42 Correct 68 ms 4728 KB Output is correct
43 Correct 66 ms 4712 KB Output is correct
44 Correct 66 ms 4340 KB Output is correct
45 Correct 65 ms 4428 KB Output is correct
46 Correct 69 ms 4344 KB Output is correct
47 Correct 63 ms 4132 KB Output is correct
48 Correct 78 ms 7836 KB Output is correct
49 Correct 69 ms 8432 KB Output is correct
50 Correct 70 ms 8472 KB Output is correct
51 Correct 75 ms 8488 KB Output is correct
52 Correct 72 ms 8420 KB Output is correct
53 Correct 69 ms 8460 KB Output is correct