| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1285357 | quan606303 | Just Long Neckties (JOI20_ho_t1) | C++20 | 68 ms | 11644 KiB |
/*
* @Author: RMQuan
* @Date: 2025-10-30 13:55:55
* @Last Modified by: RMQuan
* @Last Modified time: 2025-10-30 14:24:10
*/
/*idea :
*/
#include <bits/stdc++.h>
bool M1;
#define int long long
#define ll long long
#define INTMAX INT_MAX
#define INTMIN INT_MIN
#define LONGMAX LLONG_MAX
#define LONGMIN LLONG_MIN
#define fi first
#define se second
#define memfull(a,b) memset(a,b,sizeof(a));
#define endl '\n'
#define TASK "TEST"
#define file() if (fopen(TASK".inp","r")){freopen(TASK".inp","r",stdin); freopen(TASK".out","w",stdout);}
using namespace std;
const int MOD=1e9+7;
const int maxn=2e5+7;
pair<int,int> a[maxn];
int n,b[maxn];
int pre[maxn],suf[maxn],ans[maxn];
int32_t main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
file();
cin>>n;
for (int i=1;i<=n+1;i++)
{
cin>>a[i].fi;
a[i].se=i;
}
sort(a+1,a+2+n);
for (int i=1;i<=n;i++)cin>>b[i];
sort(b+1,b+1+n);
for (int i=1;i<=n;i++)pre[i]=max(pre[i-1],max(0LL,a[i].fi-b[i]));
for (int i=n+1;i>1;i--)suf[i]=max(suf[i+1],max(0LL,a[i].fi-b[i-1]));
for (int i=1;i<=n+1;i++)ans[a[i].se]=max(pre[i-1],suf[i+1]);
for (int i=1;i<=n+1;i++)cout<<ans[i]<<" ";
bool M2;
cerr<<"-------------------------------------------------"<<endl;
cerr<<"Time : "<<clock()<<" ms"<<endl;
cerr<<"Memory : "<<abs(&M2-&M1)/1024/1024<<" MB"<<endl;
cerr<<"-------------------------------------------------"<<endl;
return 0;
}
컴파일 시 표준 에러 (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... | ||||
