Submission #1049292

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10492922024-08-08 16:00:28Ahmed57Wiring (IOI17_wiring)C++17
0 / 100
1 ms348 KiB
#include "bits/stdc++.h"
using namespace std;
long long min_total_length(vector<int> r, vector<int> b){
vector<pair<long long,int>> v;
for(auto i:r){
v.push_back({i,0});
}
for(auto i:b){
v.push_back({i,1});
}
sort(v.begin(),v.end());
int n = v.size();
long long pref[n+1] = {0};
for(int i = 0;i<n;i++){
pref[i+1] = v[i].first;
pref[i+1]+=pref[i];
}
int st[n],en[n];
for(int i = 0;i<n;i++){
if(i==0||v[i].first!=v[i-1].first){
st[i] = i;
}else st[i] = st[i-1];
}
for(int i = n-1;i>=0;i--){
if(i==n-1||v[i].first!=v[i+1].first){
en[i] = i;
}else en[i] = en[i+1];
}
long long dp[n+1][2];
for(int i = 0;i<=n;i++)dp[i][0] = dp[i][1] = 1e18;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
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...