제출 #906277

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
9062772024-01-13 22:41:24OAleksaJust Long Neckties (JOI20_ho_t1)C++14
100 / 100
89 ms14088 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define f first
#define s second
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int tt = 1;
//cin >> tt;
while (tt--) {
int n;
cin >> n;
vector<pair<int, int>> a(n + 1);
vector<int> b(n);
for (int i = 0;i < n + 1;i++)
cin >> a[i].f, a[i].s = i;
for (int i = 0;i < n;i++)
cin >> b[i];
sort(a.begin(), a.end());
sort(b.begin(), b.end());
vector<int> s(n + 2);
s[n] = max(a[n].f - b[n - 1], 0ll);
for (int i = n - 1;i >= 1;i--)
s[i] = max(s[i + 1], max(a[i].f - b[i - 1], 0ll));
vector<int> ans(n + 1);
int mx = 0;
for (int i = 0;i < n + 1;i++) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...