Submission #1114629

#TimeUsernameProblemLanguageResultExecution timeMemory
1114629AdamGSJust Long Neckties (JOI20_ho_t1)C++17
9 / 100
1049 ms8008 KiB
#include <bits/stdc++.h> #pragma gcc optimize(O3) using namespace std; typedef long long ll; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); ll n, c; cin >> n; vector<pair<ll, ll>> a; vector<ll> b; for (int i=0; i<=n; i++){ cin >> c; a.push_back({c, i}); } for (int i=0; i<n; i++){ cin >> c; b.push_back(c); } sort(a.begin(), a.end()); sort(b.begin(), b.end()); ll wyn, ind_b; for (int us=0; us<=n; us++){ wyn = 0; ind_b = n-1; for (int ind_a=n; ind_a>=0; ind_a--){ if (a[ind_a].second==us) continue; wyn = max(wyn, max((ll)0, a[ind_a].first-b[ind_b])); ind_b--; } cout << wyn << " "; } return 0; }

Compilation message (stderr)

ho_t1.cpp:2: warning: ignoring '#pragma gcc optimize' [-Wunknown-pragmas]
    2 | #pragma gcc optimize(O3)
      |
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...