Submission #210150

#TimeUsernameProblemLanguageResultExecution timeMemory
210150AMO5Just Long Neckties (JOI20_ho_t1)C++98
0 / 100
5 ms424 KiB
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define mp make_pair #define pb push_back #define all(x) (x).begin(), (x).end() #define MOD 1000000007 typedef long long ll; typedef pair <int, int> ii; typedef pair <ll, ll> pll; typedef vector<int> vi; typedef vector<ll> vll; typedef long double ld; long long INF=LLONG_MAX; vector <pll> a; int main() { ios_base::sync_with_stdio(0); cin.tie(0); //freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); int n; cin >> n; ll b[n],ans[n+1],x; for(int i = 0; i <= n; i++){ cin >> x; a.pb({x,ll(i)}); ans[i] = 0; } for(int i = 0; i < n; i++)cin >> b[i]; sort(all(a)); sort(b,b+n); for(int i = 0; i <= n; i++){ ll cnt = 0; for(int j = 0; j < n; j++){ if(i==j)continue; if(j<i) cnt = max(a[j].fi-b[j],cnt); else cnt = max(a[j].fi-b[j-1],cnt); } ans[a[i].se] = cnt; } for(int i = 0; i <= n; i++)cout << ans[i] << ' '; cout << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...