Submission #1129617

#TimeUsernameProblemLanguageResultExecution timeMemory
1129617Hurryup_7735Growing Vegetables is Fun 5 (JOI24_vegetables5)C++20
4 / 100
5093 ms4164 KiB
//What did I do to deserve it?! #pragma GCC optimize("O3") #include <bits/stdc++.h> using namespace std; #define ll long long #define ld long double #define endl '\n' #define pb push_back #define pf push_front #define speedyboy ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); #define all(x) x.begin() , x.end() #define allr(x) x.rbegin() , x.rend() #define F first #define S second #define pll pair<ll , ll> #define pss pair<string , string> #define YES cout << "YES" << endl; #define NO cout << "NO" << endl; const ll sz = 5e5 + 5 , INF = 1e18 , MOD = 1e9 + 7; ll a[sz]; vector<pll> v; ll i , j , k; void solve(){ ll n; cin >> n; for(i = 1 ; i <= 2 * n ; i++) cin >> a[i]; for(i = 1 ; i <= n ; i++){ ll x; cin >> x; v.pb({x , 0}); } for(i = 1 ; i <= n ; i++){ ll x; cin >> x; v.pb({x , 1}); } sort(all(v)); ll mn = INF; do{ ll mx = -INF; bool ok = false; for(i = 0 ; i < v.size() ; i++){ mx = max(mx , abs(v[i].F - a[i + 1])); if(v[i].S == v[i + 1].S){ ok = true; } } mn = min(mx , mn); }while(next_permutation(all(v))); cout << mn << endl; } signed main(){ speedyboy; //open; ll t = 1; //cin >> t; while(t--){ solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...