Submission #1114614

#TimeUsernameProblemLanguageResultExecution timeMemory
1114614AdamGSJust Long Neckties (JOI20_ho_t1)C++17
9 / 100
1067 ms4312 KiB
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n,k,odd,index; cin >> n; vector<pair<int,int>>dostepne_szyje; vector<int>jakie_maja_ludzie; for(int i=0;i<n+1;++i){ cin >> k; dostepne_szyje.push_back({k,i+1}); } sort(dostepne_szyje.begin(),dostepne_szyje.end()); for(int i=0;i<n;++i){ cin >> k; jakie_maja_ludzie.push_back(k); } sort(jakie_maja_ludzie.begin(),jakie_maja_ludzie.end()); for(int i=1;i<n+2;++i){ odd=0; index=0; for(int j=0;j<n+1;++j){ if(dostepne_szyje[j].second==i) continue; odd=max(odd,dostepne_szyje[j].first-jakie_maja_ludzie[index]); index++; } cout << odd << ' '; } cout << endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...