Submission #1153302

#TimeUsernameProblemLanguageResultExecution timeMemory
1153302zhasynJust Long Neckties (JOI20_ho_t1)C++20
0 / 100
0 ms324 KiB
#include <bits/stdc++.h> #define pb push_back #define pf push_front using namespace std; #define F first #define S second typedef long long ll; #define pii pair <int, int> #define pll pair <ll, ll> typedef long double ld; const ll N = 2 * 1e5 + 100, M = 4096 + 10, len = 21, inf = 1e18; const ll mod = 1e9 + 7; pll a[N]; ll b[N]; int main(){ ios::sync_with_stdio(false); cin.tie(NULL); ll n; cin >> n; for(ll i = 0; i <= n; i++){ cin >> a[i].F; a[i].S = i; } for(ll i = 0; i < n; i++){ cin >> b[i]; } sort(a, a + n + 1); sort(b, b + n); for(ll i = 0; i <= n; i++){ ll plus = 0, mn = 0; for(ll j = 0; j < n; j++){ if(a[j].S == i) plus = 1; mn = max(mn, abs(a[j + plus].F - b[j])); //cout << a[j + plus].F << " " << b[j] << endl; } cout << mn << " "; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...