QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#411043#1156. Robotskwongweng0 2561ms40192kbC++171.6kb2024-05-14 20:42:462024-05-14 20:42:46

Judging History

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

  • [2024-05-14 20:42:46]
  • 评测
  • 测评结果:0
  • 用时:2561ms
  • 内存:40192kb
  • [2024-05-14 20:42:46]
  • 提交

answer

#include "robots.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long double ld;
typedef vector<vector<ll>> vll;
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define ROF(i, a, b) for(int i = a; i >= b; i--)
#define pb push_back
#define ms memset
#define fi first
#define se second

int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
    sort(X,X+A); sort(Y,Y+B);
    FOR(i,0,T){
        if (W[i]>=X[A-1] && S[i]>=Y[B-1]) return -1;
    }
    int l = 0, r = T+1;
    vii w(T+A);
    FOR(i,0,T) w[i] = {W[i],S[i]};
    FOR(i,T,T+A) w[i] = {X[i-T],0};
    sort(w.begin(), w.end());
    while (r-l>1){
        int mid = (l+r)/2;
        multiset<int> p;
        FOR(i,0,T+A){
            if (w[i].se > 0){
                p.insert(w[i].se); continue;
            }
            int cnt = 0;
            while (!p.empty() && cnt < mid){
                p.erase(*(--p.end())); cnt++;
            }
        }
        vii rem;
        for (int u : p) rem.pb({u,1});
        FOR(i,0,B) rem.pb({Y[i],0});
        sort(rem.begin(), rem.end());
        multiset<int> q;
        FOR(i,0,rem.size()){
            if (rem[i].se>0){
                q.insert(rem[i].fi); continue;
            }
            int cnt = 0;
            while (!q.empty() && cnt < mid){
                q.erase((--q.end())); cnt++;
            }
        }
        if (q.empty()){
            r=mid;
        }else{
            l=mid;
        }
    }
    return r;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 14
Accepted
time: 1ms
memory: 5852kb

input:

1 1 2
13
13
5 6
13 13

output:

-1

result:

ok single line: '-1'

Test #2:

score: 0
Accepted
time: 1ms
memory: 5812kb

input:

0 2 2

20 10
7 10
13 10

output:

2

result:

ok single line: '2'

Test #3:

score: 0
Accepted
time: 0ms
memory: 5816kb

input:

2 0 2
10 20

10 7
10 13

output:

2

result:

ok single line: '2'

Test #4:

score: 0
Accepted
time: 1ms
memory: 5844kb

input:

1 1 2
13
13
15 6
5 16

output:

1

result:

ok single line: '1'

Test #5:

score: 0
Accepted
time: 1ms
memory: 5816kb

input:

0 2 2

15 15
7 8
5 6

output:

1

result:

ok single line: '1'

Test #6:

score: 0
Accepted
time: 1ms
memory: 7884kb

input:

2 0 2
15 15

7 8
5 6

output:

1

result:

ok single line: '1'

Test #7:

score: -14
Wrong Answer
time: 0ms
memory: 6068kb

input:

2 0 2
20 1

10 10
10 10

output:

1

result:

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

Subtask #2:

score: 0
Time Limit Exceeded

Test #8:

score: 14
Accepted
time: 2561ms
memory: 31568kb

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:

17

result:

ok single line: '17'

Test #9:

score: 0
Accepted
time: 71ms
memory: 11860kb

input:

50000 0 500000
1259308694 1722606921 1479714896 1475931297 1942320254 1106961993 1138541861 1203363162 1463675587 1275336085 1847766630 1321488338 1222281203 1591977596 1409525422 1599394067 1145145532 1323526439 1598712171 1714056360 1476058962 1328447976 1935622082 1438076232 1341274687 1862703150...

output:

-1

result:

ok single line: '-1'

Test #10:

score: 0
Accepted
time: 34ms
memory: 6588kb

input:

50000 0 50000
113928 75954 27813 115923 126882 62226 23610 50853 75387 41997 41316 45291 109398 32691 53328 120774 113403 75204 143499 136305 2766 4464 134799 7683 14460 87384 12351 103104 59130 17037 129444 97344 145227 146124 27390 123153 66891 70968 61710 51729 103593 9702 107829 22188 118152 962...

output:

2

result:

ok single line: '2'

Test #11:

score: 0
Accepted
time: 543ms
memory: 29052kb

input:

50000 0 500000
138858 89022 139041 109101 28452 78147 110283 112965 95913 2007 37164 6264 147498 143694 12576 3606 104232 96870 67764 62778 121602 58416 119397 35865 71124 79884 62370 93516 133611 115716 55941 146244 100728 52704 55095 15102 135777 59718 7869 131775 33159 122232 22851 121371 59238 8...

output:

11

result:

ok single line: '11'

Test #12:

score: 0
Accepted
time: 1333ms
memory: 40192kb

input:

50000 0 500000
776960000 773040000 1171760000 1106920000 1732640000 446960000 890920000 1737520000 183680000 728320000 1966120000 942880000 1218000000 694600000 1128640000 1696200000 1193000000 1572880000 532400000 1039840000 1833680000 1441840000 1447480000 553240000 366480000 515920000 1723560000 ...

output:

15

result:

ok single line: '15'

Test #13:

score: -14
Time Limit Exceeded

input:

50000 0 500000
1387853151 1101982239 1390128723 1447889751 1825875294 1064550393 1343204970 1060204064 1069119716 1342433657 1845505214 1670914465 1462776488 1460089570 1107081731 1950533753 1254549911 1866646965 1625749264 1138872479 1104010740 1231654841 1769368758 1137413788 1611385869 1233773347...

output:


result:


Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

0%