이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "robots.h"
#include <algorithm>
#include <iostream>
#include <vector>
#include <cassert>
using namespace std;
int putaway(int wrobot, int srobot, int n, int rw[], int rs[], int w[], int s[]) {
    assert(srobot == 0);
    sort(rw, rw + wrobot);
    sort(w, w + n);
    auto check = [&](int time)->bool {
        int cnt = 0;
        int toy = 0;
        for (int robot = 0; robot < wrobot; robot++) {
            while (toy < n && rw[robot] >= w[toy]) {
                toy++;
                cnt++;
            }
            cnt = max(cnt - time, 0);
        }
        return cnt == 0 && toy == n;
    };
    int l = -1, r = n +1;
    while (l < r - 1) {
        int mid = (l + r) / 2;
        if (check(mid)) r = mid;
        else l = mid;
    }
    return r == n+1 ? -1 : r;
}
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |