Submission #958283

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9582832024-04-05 10:05:13aykhnJust Long Neckties (JOI20_ho_t1)C++17
100 / 100
102 ms15440 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define inf 0x3F3F3F3F
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
int a[n + 2], b[n + 1], p[n + 2], s[n + 3], ans[n + 2];
for (int i = 1; i <= n + 1; i++) cin >> a[i];
for (int i = 1; i <= n; i++) cin >> b[i];
vector<int> o(n + 2, 0);
iota(o.begin() + 1, o.end(), 1);
sort(o.begin() + 1, o.end(), [&](const int &x, const int &y)
{
return a[x] < a[y];
});
sort(a + 1, a + n + 2);
sort(b + 1, b + n + 1);
p[0] = -inf;
s[n + 2] = -inf;
for (int i = 1; i <= n; i++) p[i] = max(p[i - 1], a[i] - b[i]);
for (int i = n + 1; i > 1; i--) s[i] = max(s[i + 1], a[i] - b[i - 1]);
for (int i = 1; i <= n + 1; i++)
{
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...