Submission #1114630

#TimeUsernameProblemLanguageResultExecution timeMemory
1114630AdamGSJust Long Neckties (JOI20_ho_t1)C++17
9 / 100
1055 ms2640 KiB
#include <iostream> #include <vector> #include <algorithm> #include <utility> using namespace std; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, out; bool skipped; vector<int> employees; vector<pair<int, int>> neckties; cin>>n; neckties.resize(n+1); employees.resize(n); for (int i=0;i<n+1;i++){ cin>>neckties[i].first; neckties[i].second=i; } for (int i=0;i<n;i++) cin>>employees[i]; sort(neckties.begin(), neckties.end(), greater<pair<int, int>>()); sort(employees.begin(), employees.end(), greater<int>()); for (int i=0;i<n+1;i++){ out=0; skipped=false; for (int j=0;j<n+1;j++){ if (neckties[j].second==i){ skipped=true; continue; } if (skipped) out=max(out, neckties[j].first-employees[j-1]); else out=max(out, neckties[j].first-employees[j]); } cout<<out<<" "; } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...