# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1114650 | AdamGS | Just Long Neckties (JOI20_ho_t1) | C++17 | 94 ms | 13676 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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,ciag;
vector<int>jakie_maja_ludzie;
vector<int>s(1),p(1);
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=0;i<n;++i){
p.push_back(max(p[i],max(dostepne_szyje[i].first-jakie_maja_ludzie[i],0)));
}
for(int i=n;i>0;--i){
s.push_back(max(s[n-i],max(dostepne_szyje[i].first-jakie_maja_ludzie[i-1],0)));
//cout << s[n-i] << endl;
}
for(int i=0;i<p.size();++i){
//cout << p[i] << ' ';
}
//cout << endl;
for(int i=0;i<s.size();++i){
//cout << s[i] << ' ';
}
//cout << endl;
for(int i=0;i<n+1;++i){
ciag.push_back({dostepne_szyje[i].second,max(p[i],s[n-i])});
}
sort(ciag.begin(),ciag.end());
for(int i=0;i<ciag.size();++i){
cout << ciag[i].second << ' ';
}
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |