Please read our Rules and continue to report content that violates our rules on underage content.
main image
Uploaderanalogman, avatar
TagsEhsan, Kak_Ros, Upin_&_Ipin
Source Link
Unknown
LockedNo
Info3508x2480 // 3.8MB // jpg
- Reply
Anonymous1: kak ros kawaii
- Reply
Anonymous2: tf?
- Reply
Anonymous3(2): // https://codeforces.com/contest/1089/problem/L
#include <bits/stdc++.h>

const int M=1e5+7;

int main()
{
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n, k;
std::cin>>n>>k;
int j[M];
for(int i=1; i<=n; i++)
{
std::cin>>j[i];
}
std::vector<int> a[M];
for(int i=1; i<=n; i++)
{
int t;
std::cin>>t;
a[j[i]].push_back(t);
}
int spare=0;
std::vector<int> s;
for(int i=1; i<=k; i++)
{
if(a[i].empty())
{
spare++;
continue;
}
std::sort(a[i].begin(),a[i].end());
a[i].pop_back();
for(auto x:a[i])
{
s.push_back(x);
}
}
std::sort(s.begin(),s.end());
long long kte=0;
for(int i=0; i<spare; i++)
{
kte+=s[i];
}
std::cout<<kte;
return 0;
}
/*
8 7
1 1 3 1 5 3 7 1
5 7 4 8 1 3 5 2
*/
- Reply
Anonymous4: More Kak Ros, please?
- Reply
Anonymous5: 6/10,lumayan crot
- Reply
Anonymous6: Kak Ros upin


Report an ad?