Submission #567074

#TimeUsernameProblemLanguageResultExecution timeMemory
567074AbdullahMWJust Long Neckties (JOI20_ho_t1)C++17
9 / 100
1094 ms12736 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); unordered_map <ll, ll> occ; for (ll i = 0; i <= n; i++) { cin >> nw[i]; occ[i] = 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++) { bool hap = 0; if (occ[i] != nw[x] || hap) { ll nm = max((ll) 0, nw[x] - init[y]); mx = max(mx, nm); y++; } else hap = 1; } cout << mx << ' '; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...