| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 993304 | Muaath_5 | Robots (IOI13_robots) | C++17 | 3043 ms | 31924 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2")
#include "robots.h"
#include <bits/stdc++.h>
using namespace std;
int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
    sort(X, X+A);
    sort(Y, Y+B);
    vector<pair<int, int>> v;
    for (int i = 0; i < T; i++)
        v.push_back({W[i], S[i]});
    sort(v.begin(), v.end());
    for (int i = 0; i < T; i++) {
        W[i] = v[i].first, S[i] = v[i].second;
        if (W[i] >= X[A-1] && S[i] >= Y[B-1])
            return -1;
    }
        
    if (T == 2 && A+B == 2) {
        if (A==2) {
            if (*max_element(X, X+A) <= *max_element(W, W+T)) return -1;
            if (X[0] > W[0] && X[1] > W[1]) return 1;
            return 2;
        }
        if (B==2) {
            if (*max_element(Y, Y+B) <= *max_element(S, S+T)) return -1;
            if (Y[0] > S[0] && Y[1] > S[1]) return 1;
            return 2;
        }
        if ((X[0] > W[0] && Y[0] > S[1]) ||
            (X[0] > W[1] && Y[0] > S[0]))
            return 1;
        if ((X[0] > W[0] && X[0] > W[1]) ||
            (Y[0] > S[0] && Y[0] > S[1]))
            return 2;
        return -1;
    }
    if (B == 0) {
        multiset<int> s;
        for (int i = 0; i < T; i++)
            s.insert(W[i]);
        int sol = 0, st = 0;
        while (s.size()) {
            for (int i = A-1; s.size() && i >= 0; i--) {
                auto it = s.lower_bound(X[i]);
                if (it == s.begin()) break;
                it--;
                s.erase(it);
            }
            sol++;
        }
        return sol;
    }
    return 0;
}
Compilation message (stderr)
| # | 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... | ||||
