| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 364606 | Killer2501 | Just Long Neckties (JOI20_ho_t1) | C++14 | 138 ms | 19180 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define pb push_back
#define task "sequence"
#define pll pair<ll, ll>
#define pii pair<vector<ll>, ll>
#define fi first
#define se second
using ll = long long;
const long long mod = 1e15+7;
const ll mod1 = 1e9+1;
const ll N = 2e5+5;
const int base = 350;
using ull = unsigned long long;
using namespace std;
string s, ss;
ll n, m, t, k, T, cnt, tong, a[N], c[N], b[N], l[N], r[N], d[N];
vector<ll> adj[N], kq;
pll p[N];
bool cmp(const ll& x, const ll& y)
{
return a[x] < a[y];
}
void sol()
{
cin >> n;
for(int i = 1; i <= n+1; i ++)cin >> a[i], c[i] = i;
for(int i = 1; i <= n; i ++)cin >> b[i];
sort(b+1, b+1+n);
sort(c+1, c+1+n+1, cmp);
for(int i = 1; i <= n; i ++)
{
//cout << a[c[i]] <<" "<<b[i]<<'\n';
d[c[i]] = i;
l[i] = max(l[i-1], a[c[i]] - b[i]);
}
for(int i = n+1; i > 1; i --)
{
r[i] = max(r[i+1], a[c[i]] - b[i-1]);
d[c[i]] = i;
}
//for(int i = 1; i <= n+1; i ++)cout << d[i] <<" ";
for(int i = 1; i <= n+1; i ++)cout << max(l[d[i]-1], r[d[i]+1])<<" ";
}
int main()
{
if(fopen(task".in", "r")){
freopen(task".in", "r", stdin);
freopen(task".out", "w", stdout);
}
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int ntest;
ntest = 1;
//cin >> ntest;
//cout << (1<<30) << '\n';
while(ntest -- > 0)
sol();
}
컴파일 시 표준 에러 (stderr) 메시지
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
