竞赛讨论区 > 过不了,这辈子都不可能过题
头像
义往尘沙
发布于 2021-07-28 08:58
+ 关注

过不了,这辈子都不可能过题

// https://ac.nowcoder.com/acm/contest/17624/J
// 永远75%通过,,哪个大佬能把剩下25%的数据给我aaaaa
#include <iostream>
#include <algorithm>
using namespace std;
#define TLE ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define pii pair<int, int>
#define fi first
#define se second
#define int long long
const int Mod = 1e9 + 7;
const int N = 1e6 + 7;
int L = 1e9 + 1;
int a[N];
int n;
int l, r;
int ans, head, len;
signed main()
{
    int tt, t;
    cin >> n >> l >> r;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
    }
    for (int i = 1; i <= n; i++)
    {
        cin >> t;
        if (!t)
        {
            if (l)
                a[i] = -a[i], l--;
            else
                a[i] = L + 100;
        }
    }
    sort(a + 1, a + 1 + n);
    while (a[n] > L)
        n--;
    head = len = n;
    ans = L - a[head];
    t = min(r, l) / len;
    ans += t * L * 2;
    r -= len * t;
    l -= len * t;
    while (r)
    {
        len = min(r, len);
        r -= len;
        ans += L;
        if (!l)break;
        len = min(len, l);
        l -= len;
        ans += L;
    }
    ans += (a[head] - a[head - len + 1]);
    cout << ans << endl;
}


全部评论

(1) 回帖
加载中...
话题 回帖

等你来战

查看全部

热门推荐