Submission #1126060

#TimeUsernameProblemLanguageResultExecution timeMemory
1126060m_bezrutchkaRobots (IOI13_robots)C++20
14 / 100
108 ms4576 KiB
#include "robots.h"
#include <bits/stdc++.h>
using namespace std;

typedef pair<int, int> pii;

int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
    // sub1
    assert(T == 2 && A + B == 2);
    pii toys[2];
    if (A == 2) {
        toys[0] = {W[0], S[0]};
        toys[1] = {W[1], S[1]};
        sort(X, X + A);
        sort(toys, toys + 2);
        if (toys[0].first < X[0] && toys[1].first < X[1]) {
            return 1;
        } else if (toys[1].first < X[1]) {
            return 2;
        } else {
            return -1;
        }
    } else if (B == 2) {
        toys[0] = {S[0], W[0]};
        toys[1] = {S[1], W[1]};
        sort(Y, Y + B);
        sort(toys, toys + 2);
        if (toys[0].first < Y[0] && toys[1].first < Y[1]) {
            return 1;
        } else if (toys[1].first < Y[1]) {
            return 2;
        } else {
            return -1;
        }

    } else {
        int w = X[0], s = Y[0];
        if ((W[0] < w && S[1] < s) ||
            (S[0] < s && W[1] < w)) {
            return 1;
        } else if ((W[0] < w && W[1] < w) || (S[0] < s && S[1] < s)) {
            return 2;
        } else {
            return -1;
        }
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...