Submission #1154885

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
11548852025-02-21 11:15:01alexddWiring (IOI17_wiring)C++20
17 / 100
1095 ms14508 KiB
#include "wiring.h"
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int INF = 1e18;
int dp[200005];
int tole[200005],tori[200005];
int pref[200005];
int minp[200005][2],mins[200005][2];
long long min_total_length(std::vector<int32_t> r, std::vector<int32_t> b)
{
vector<pair<int,int>> v;
for(int x:r)
v.push_back({x,0});
for(int x:b)
v.push_back({x,1});
v.push_back({-1,-1});
sort(v.begin(),v.end());
int ult[2] = {0,0};
for(int i=1;i<v.size();i++)
{
ult[v[i].second] = i;
tole[i] = ult[1-v[i].second];
pref[i] = pref[i-1] + v[i].first;
}
ult[0] = ult[1] = (int)v.size()-1;
for(int i=(int)v.size()-1;i>0;i--)
{
ult[v[i].second] = i;
tori[i] = ult[1-v[i].second];
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...