제출 #365495

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
3654952021-02-11 18:17:19denkendoemeer전선 연결 (IOI17_wiring)C++14
0 / 100
1 ms364 KiB
#include<bits/stdc++.h>
#include "wiring.h"
using namespace std;
#define ll long long
vector<pair<int,bool>>pct;
ll dp[200005],last[200005];
int t[200005],cnt[200005];
ll calc(int l,int r)
{
int aux=t[r],st=r+1-aux,dr=aux-l;
ll ans=last[r+1]-last[aux]-last[aux]+last[l];
if (st>dr)
ans=ans-1LL*(st-dr)*pct[aux-1].first;
if (st<dr)
ans=ans+1LL*(dr-st)*pct[aux].first;
return ans;
}
ll min_total_length(vector<int>red,vector<int>blue)
{
int n=blue.size(),m=red.size();
int i;
for(i=0;i<n;i++)
pct.push_back(make_pair(blue[i],1));
for(i=0;i<m;i++)
pct.push_back(make_pair(red[i],0));
sort(pct.begin(),pct.end());
n=n+m;
for(i=1;i<=n;i++)
last[i]=last[i-1]+pct[i-1].first;
for(i=0;i<n;i++)
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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...