QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#563989#1156. Robotsmakrav#0 170ms16248kbC++201.8kb2024-09-14 18:23:582024-09-14 18:23:59

Judging History

你现在查看的是最新测评结果

  • [2024-09-14 18:23:59]
  • 评测
  • 测评结果:0
  • 用时:170ms
  • 内存:16248kb
  • [2024-09-14 18:23:58]
  • 提交

answer

#include "robots.h"
#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (int) (x).size()

int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
    vector<int> ord_weak(A), ord_small(B);
    iota(all(ord_weak), 0); iota(all(ord_small), 0);
    sort(all(ord_weak), [&](int p1, int p2) {
        return X[p1] < X[p2];
    });
    sort(all(ord_small), [&](int p1, int p2) {
        return Y[p1] < Y[p2];
    });

    vector<int> toys_order(T), tow(T);
    iota(all(toys_order), 0); iota(all(tow), 0);
    sort(all(tow), [&](int p1, int p2) {return W[p1] < W[p2];});
    sort(all(toys_order), [&](int p1, int p2) {
        return S[p1] < S[p2];
    });

    int L = 0, R = T + 1;
    while (R - L > 1) {
        int M = (L + R) / 2;
        int ci = 0;
        vector<int> used(T, 0);
        set<pair<int, int>> st;
        for (int i = 0; i < sz(ord_small); i++) {
            while (ci < T && S[toys_order[ci]] < Y[ord_small[i]]) {
                st.insert({-W[toys_order[ci]], toys_order[ci]});
                ci++;
            }
            int cur = M;
            while (cur && !st.empty()) {
                auto it = st.begin();
                used[(*it).second] = 1;
                st.erase(it); cur--;
            }
        }
        int cb = 0;
        int siiu = 0;
        for (int i = 0; i < sz(ord_weak); i++) {
            while (siiu < T && W[tow[siiu]] < X[ord_weak[i]]) {
                siiu++;
                cb += used[siiu - 1];
            }
            cb = max(0, cb - M);
        }
        while (siiu < T) {
            cb += used[siiu];
            siiu++;
        }
        if (cb) L = M;
        else R = M;
    }
    return R;
}   

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 5872kb

input:

1 1 2
13
13
5 6
13 13

output:

1

result:

wrong answer 1st lines differ - expected: '-1', found: '1'

Subtask #2:

score: 0
Wrong Answer

Test #8:

score: 0
Wrong Answer
time: 170ms
memory: 16248kb

input:

50000 0 500000
1957680000 64280000 235160000 1384760000 1279320000 1005400000 1481760000 1129920000 1774640000 494160000 763120000 419640000 1742880000 1083000000 278360000 64040000 576880000 1479760000 1872320000 158480000 1183880000 81320000 249920000 30920000 1909240000 870920000 842280000 445640...

output:

1

result:

wrong answer 1st lines differ - expected: '17', found: '1'

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

0%