Submission #217410

#TimeUsernameProblemLanguageResultExecution timeMemory
217410AMO5Just Long Neckties (JOI20_ho_t1)C++98
9 / 100
1092 ms8808 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; ll INF=LLONG_MAX; ll b[200222],c[200222]; vll 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; for(int i=0; i<=n; i++){ cin >> c[i]; a.pb(c[i]); } for(int i=0; i<n; i++)cin >> b[i]; sort(b,b+n); sort(a.begin(),a.end()); for(int i=0; i<=n; i++){ auto ptr = find(a.begin(),a.end(),c[i])-a.begin(); ll mx = 0; int up=0; for(int j=0; j<n; j++){ if(j==ptr){ up=1; } mx = max(mx,a[j+up]-b[j]); } cout << mx << ' '; } cout << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...