답안 #781645

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
781645 2023-07-13T09:07:58 Z vjudge1 Just Long Neckties (JOI20_ho_t1) C++17
0 / 100
1 ms 296 KB
#include<bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);
//#define endl "\n"
#define ll long long
#define pb push_back
#define N 200005

int main(){
	int n;cin>>n;
	vector<pair<ll int,int>> arr;
	vector<ll int> mus;
	ll int cev[n+1];
	for(int i=0;i<n+1;i++){
		ll int a;cin>>a;
		arr.pb({a,i});
	}
	for(int i=0;i<n;i++){
		ll int a;cin>>a;
		mus.pb(a);
	}
	sort(arr.begin(),arr.end());sort(mus.begin(),mus.end());
	for(int i=0;i<n+1;i++){
		ll int fark=0;
		int gel=0;
		//cout<<i<<" "<<arr[i].first<<endl;
		for(int j=0;j<n;j++){
			if(j==i)gel=1;
			//cout<<arr[j+gel].first<<" "<<mus[j]<<" "<<j<<" "<<fark<<endl;
			fark=max(fark,abs(arr[j+gel].first-mus[j]));
		}
		cev[arr[i].second]=fark;
	}
	for(int i=0;i<=n;i++)cout<<cev[i]<<" ";
	cout<<endl;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 296 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 296 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 296 KB Output isn't correct
3 Halted 0 ms 0 KB -