이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fir first
#define sec second
typedef long long ll;
int main()
{
ios_base::sync_with_stdio(1);
int n;
vector <pair<int,int>> ties;
cin>>n;
int pecat[n+1];
for (int i=0; i<=n; i++)
{
int a;
cin>>a;
ties.pb({a,i});
}
vector <int> empl;
for (int i=0; i<n; i++)
{
int a;
cin>>a;
empl.pb(a);
}
sort(ties.begin(), ties.end());
sort(empl.begin(), empl.end());
int weird = 0;
for (int i=0; i<n; i++)
{
weird = max(weird, ties[i].fir-empl[i]);
}
for (int i=n; i>0; i--)
{
pecat[ties[i].sec] = weird;
weird = max (weird, ties[i].fir - empl[i-1]);
}
pecat[ties[0].sec] = weird;
for (int i=0; i<=n; i++)
{
cout<<pecat[i]<<" ";
}
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |