Submission #567055

#TimeUsernameProblemLanguageResultExecution timeMemory
567055AbdullahMWJust Long Neckties (JOI20_ho_t1)C++14
0 / 100
0 ms212 KiB
#include <bits/stdc++.h> #define all(vec) vec.begin(), vec.end() #define ll long long #define db double #define pb push_back #define pf push_front #define newl "\n" #define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define f first #define s second #define MOD 1000000007 using namespace std; #pragma GCC diagnostic ignored "-Wunused-result" void setIO(string name = "") { ios_base::sync_with_stdio(0); cin.tie(0); cout << fixed << setprecision(15); if (name.size()) { freopen((name+".in").c_str(), "r", stdin); freopen((name+".out").c_str(), "w", stdout); } } int main() { fast //setIO(""); //freopen("filename.in", "r", stdin); //freopen("filename.out", "w", stdout); ll n; cin >> n; vector <ll> nw(n + 1), init(n); for (ll i = 0; i <= n; i++) cin >> nw[i]; for (ll i = 0; i < n; i++) cin >> init[i]; sort(all(nw)); sort(all(init)); for (ll i = 0; i <= n; i++) { ll mx = 0; for (ll x = 0, y = 0; x < n; x++) { if (i != x) { ll nm = max((ll) 0, nw[x] - init[y]); mx = max(mx, nm); y++; } } cout << mx << ' '; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...