Submission #1153307

#TimeUsernameProblemLanguageResultExecution timeMemory
1153307zhasynJust Long Neckties (JOI20_ho_t1)C++20
9 / 100
1093 ms4956 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, mx = 0; for(ll j = 0; j < n; j++){ if(a[j].S == i) plus = 1; mx = max(mx, a[j + plus].F - b[j]); //cout << a[j + plus].F << " " << b[j] << endl; } cout << mx << " "; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...