답안 #779028

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
779028 2023-07-11T06:37:25 Z OrazB Just Long Neckties (JOI20_ho_t1) C++14
100 / 100
254 ms 18576 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less<int>, rb_tree_tag,
             tree_order_statistics_node_update>
    ordered_set;
//Dijkstra->set
//set.find_by_order(x) x-position value
//set.order_of_key(x) number of strictly less elements don't need *set.??
#define N 100005
#define wr cout << "Continue debugging\n";
#define all(x) (x).begin(), (x).end()
#define ll long long int
#define pii pair <int, int>
#define pb push_back
#define ff first
#define ss second

map <int,int> cur;

int main ()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> a(n+2), b(n+1), old_a(n+2);
	for (int i = 1; i <= n+1; i++) cin >> a[i], cur[a[i]] = 1e9+7, old_a[i] = a[i];
	for (int i = 1; i <= n; i++) cin >> b[i];
	sort(all(a)); sort(all(b));
	vector<int> suff(n+3, 0);
	for (int i = n+1; i >= 1; i--){
		suff[i] = max(suff[i+1], a[i]-b[i-1]);
	}
	int mx = 0;
	for (int i = 1; i <= n+1; i++){
		cur[a[i]] = min(cur[a[i]], max(mx, suff[i+1]));
		mx = max(mx, a[i]-b[i]);
	}
	for (int i = 1; i <= n+1; i++) cout << cur[old_a[i]] << ' ';
}	
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 324 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 324 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 2 ms 340 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 2 ms 468 KB Output is correct
18 Correct 2 ms 340 KB Output is correct
19 Correct 2 ms 340 KB Output is correct
20 Correct 2 ms 468 KB Output is correct
21 Correct 2 ms 456 KB Output is correct
22 Correct 1 ms 468 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 2 ms 468 KB Output is correct
26 Correct 2 ms 468 KB Output is correct
27 Correct 2 ms 460 KB Output is correct
28 Correct 2 ms 460 KB Output is correct
29 Correct 2 ms 340 KB Output is correct
30 Correct 2 ms 460 KB Output is correct
31 Correct 2 ms 468 KB Output is correct
32 Correct 2 ms 464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 324 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 320 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 2 ms 340 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 2 ms 468 KB Output is correct
18 Correct 2 ms 340 KB Output is correct
19 Correct 2 ms 340 KB Output is correct
20 Correct 2 ms 468 KB Output is correct
21 Correct 2 ms 456 KB Output is correct
22 Correct 1 ms 468 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 2 ms 468 KB Output is correct
26 Correct 2 ms 468 KB Output is correct
27 Correct 2 ms 460 KB Output is correct
28 Correct 2 ms 460 KB Output is correct
29 Correct 2 ms 340 KB Output is correct
30 Correct 2 ms 460 KB Output is correct
31 Correct 2 ms 468 KB Output is correct
32 Correct 2 ms 464 KB Output is correct
33 Correct 186 ms 17356 KB Output is correct
34 Correct 254 ms 18048 KB Output is correct
35 Correct 188 ms 17572 KB Output is correct
36 Correct 205 ms 17972 KB Output is correct
37 Correct 201 ms 18576 KB Output is correct
38 Correct 214 ms 18372 KB Output is correct
39 Correct 198 ms 17276 KB Output is correct
40 Correct 194 ms 17296 KB Output is correct
41 Correct 196 ms 17416 KB Output is correct
42 Correct 207 ms 17428 KB Output is correct
43 Correct 187 ms 17264 KB Output is correct
44 Correct 181 ms 16764 KB Output is correct
45 Correct 184 ms 16968 KB Output is correct
46 Correct 184 ms 16696 KB Output is correct
47 Correct 93 ms 9772 KB Output is correct
48 Correct 90 ms 9732 KB Output is correct
49 Correct 188 ms 17860 KB Output is correct
50 Correct 246 ms 17924 KB Output is correct
51 Correct 193 ms 17808 KB Output is correct
52 Correct 214 ms 17768 KB Output is correct
53 Correct 198 ms 17868 KB Output is correct