# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
244236 | WhipppedCream | Just Long Neckties (JOI20_ho_t1) | C++17 | 394 ms | 19424 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef long long ll;
#define f first
#define s second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rsz resize
const int md = 1e9+7;
const ll inf = 1e18;
const int maxn = 2e5+5;
template<class T> void ckmin(T &a, T b) { a = min(a, b); }
template<class T> void ckmax(T &a, T b) { a = max(a, b); }
ii arr[maxn];
int b[maxn];
int cur[maxn];
int ans[maxn];
multiset<int> bst;
int main()
{
int n; scanf("%d", &n);
for(int i = 1; i<= n+1; i++)
{
scanf("%d", &arr[i].f);
arr[i].s = i;
}
sort(arr+1, arr+n+2);
for(int i = 1; i<= n; i++)
{
scanf("%d", &b[i]);
}
sort(b+1, b+n+1);
for(int i = 2; i<= n+1; i++)
{
cur[i-1] = arr[i].f;
bst.insert(cur[i-1]-b[i-1]);
}
ans[arr[1].s] = *(--bst.end());
for(int i = 1; i<= n; i++)
{
bst.erase(bst.find(cur[i]-b[i]));
cur[i] = arr[i].f;
bst.insert(cur[i]-b[i]);
ans[arr[i+1].s] = *(--bst.end());
}
for(int i = 1; i<= n+1; i++) printf("%d ", ans[i]);
printf("\n");
}
컴파일 시 표준 에러 (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... |