#include "bits/stdc++.h"
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")
using namespace std;
#define vec vector
#define int long long
#define inf 1e18
const int mod = 998244353 , men = 1e9 + 7;
/*
▀█████████▄ ▄█ ▄█ ▄████████ ▄█ ▄████████ ▄██████▄ ████████▄ ▄████████ ▄████████
███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ███ ▀███ ███ ███ ███ ███
███ ███ ███▌ ███ ███ ███ ███ ███ █▀ ███ ███ ███ ███ ███ █▀ ███ ███
▄███▄▄▄██▀ ███▌ ███ ███ ███ ███ ███ ███ ███ ███ ███ ▄███▄▄▄ ▄███▄▄▄▄██▀
▀▀███▀▀▀██▄ ███▌ ███ ▀███████████ ███ ███ ███ ███ ███ ███ ▀▀███▀▀▀ ▀▀███▀▀▀▀▀
███ ██▄ ███ ███ ███ ███ ███ ███ █▄ ███ ███ ███ ███ ███ █▄ ▀███████████
███ ███ ███ ███▌ ▄ ███ ███ ███▌ ▄ ███ ███ ███ ███ ███ ▄███ ███ ███ ███ ███
▄█████████▀ █▀ █████▄▄██ ███ █▀ █████▄▄██ ████████▀ ▀██████▀ ████████▀ ██████████ ███ ███
▀ ▀ ███ ███
*/
template<typename _T>
bool chmin(_T &a, const _T &b) {
if (a > b) {
a = b;
return true;
}
return false;
}
template <typename _T>
bool chmax(_T &a, const _T &b) {
if (a < b) {
a = b;
return true;
}
return false;
}
double dist(double x1 , double y1 , double x2 , double y2){
return sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
}
inline void io(){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
}
inline void solve(){
int n;
cin >> n;
vector<pair<int , int>> a(n + 1);
vector<int> b(n) , c(n + 1);
for (int i = 0; i <= n; i++)
cin >> a[i].first , a[i].second = i;
for (auto & x : b)
cin >> x;
sort(a.begin() , a.end());
sort(b.begin() , b.end());
int mx = 0;
for (int i = 0; i < n; i++)
chmax(mx , a[i + 1].first - b[i]);
c[a[0].second] = mx;
for (int i = 1; i <= n; i++){
int res = 0;
if (i != n)
chmax(res , a[i + 1].first - b[i]);
else {
for (int i = 0; i < n; i++)
chmax(res , a[i].first - b[i]);
}
c[a[i].second] = res;
}
for (auto x : c)
cout << x << " ";
}
signed main() {
io();
int t = 1;
//~ cin >> t;
while(t--)
solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |