답안 #532136

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
532136 2022-03-02T06:57:35 Z chenyan Just Long Neckties (JOI20_ho_t1) C++17
100 / 100
122 ms 13296 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define N 200010
#define pii pair<int,int>
#define ff first
#define ss second
#define all(x) x.begin(),x.end()
#define pb emplace_back
int b[N];
pii a[N];
vector<pii>ans;
signed main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n,i,j;
	cin>>n;
	for(i=0;i<=n;i++) cin>>a[i].ff,a[i].ss=i;
	for(i=0;i<n;i++) cin>>b[i];
	sort(a,a+n+1);
	sort(b,b+n);
	int mx=0;
	for(i=0;i<n;i++) mx=max(mx,a[i].ff-b[i]);
	ans.pb(a[i].ss,mx);
	for(i=n-1;i>=0;i--){
		mx=max(mx,a[i+1].ff-b[i]);
		ans.pb(a[i].ss,mx);
	}
	sort(all(ans));
	for(auto u:ans) cout<<u.ss<<' ';
}

Compilation message

ho_t1.cpp: In function 'int main()':
ho_t1.cpp:16:10: warning: unused variable 'j' [-Wunused-variable]
   16 |  int n,i,j;
      |          ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 0 ms 316 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 0 ms 316 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 316 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 452 KB Output is correct
18 Correct 1 ms 456 KB Output is correct
19 Correct 1 ms 460 KB Output is correct
20 Correct 1 ms 460 KB Output is correct
21 Correct 1 ms 456 KB Output is correct
22 Correct 2 ms 460 KB Output is correct
23 Correct 1 ms 460 KB Output is correct
24 Correct 1 ms 460 KB Output is correct
25 Correct 1 ms 460 KB Output is correct
26 Correct 1 ms 460 KB Output is correct
27 Correct 1 ms 460 KB Output is correct
28 Correct 2 ms 460 KB Output is correct
29 Correct 2 ms 460 KB Output is correct
30 Correct 2 ms 460 KB Output is correct
31 Correct 1 ms 364 KB Output is correct
32 Correct 2 ms 460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 0 ms 316 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 316 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 460 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 452 KB Output is correct
18 Correct 1 ms 456 KB Output is correct
19 Correct 1 ms 460 KB Output is correct
20 Correct 1 ms 460 KB Output is correct
21 Correct 1 ms 456 KB Output is correct
22 Correct 2 ms 460 KB Output is correct
23 Correct 1 ms 460 KB Output is correct
24 Correct 1 ms 460 KB Output is correct
25 Correct 1 ms 460 KB Output is correct
26 Correct 1 ms 460 KB Output is correct
27 Correct 1 ms 460 KB Output is correct
28 Correct 2 ms 460 KB Output is correct
29 Correct 2 ms 460 KB Output is correct
30 Correct 2 ms 460 KB Output is correct
31 Correct 1 ms 364 KB Output is correct
32 Correct 2 ms 460 KB Output is correct
33 Correct 100 ms 12316 KB Output is correct
34 Correct 112 ms 12628 KB Output is correct
35 Correct 102 ms 12460 KB Output is correct
36 Correct 110 ms 12720 KB Output is correct
37 Correct 106 ms 13296 KB Output is correct
38 Correct 122 ms 13196 KB Output is correct
39 Correct 104 ms 12208 KB Output is correct
40 Correct 119 ms 12136 KB Output is correct
41 Correct 109 ms 12272 KB Output is correct
42 Correct 108 ms 12260 KB Output is correct
43 Correct 102 ms 12164 KB Output is correct
44 Correct 106 ms 12088 KB Output is correct
45 Correct 105 ms 12072 KB Output is correct
46 Correct 116 ms 12064 KB Output is correct
47 Correct 101 ms 11980 KB Output is correct
48 Correct 101 ms 12248 KB Output is correct
49 Correct 116 ms 12412 KB Output is correct
50 Correct 115 ms 12460 KB Output is correct
51 Correct 116 ms 12456 KB Output is correct
52 Correct 107 ms 12416 KB Output is correct
53 Correct 109 ms 12428 KB Output is correct