Submission #585845

#TimeUsernameProblemLanguageResultExecution timeMemory
585845Dan4LifeRobots (IOI13_robots)C++17
0 / 100
1 ms212 KiB
#include "robots.h"
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int,int>
#define fi first 
#define se second
#define all(a) a.begin(), a.end()
#define sz(a) (int)a.size()
const int INF = (int)1e9;
vector<pii> weak, small, toy;

bool work(int i, int j, int type){
    if(type==0) return weak[i].fi>=toy[j].fi;    
    return small[i].se>=toy[j].se;
}

int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) {
    for(int i = 0; i < A; i++) weak.pb({X[i],INF});
    for(int i = 0; i < B; i++) small.pb({INF,Y[i]});
    for(int i = 0; i < T; i++) toy.pb({W[i],S[i]});
    sort(all(weak)), sort(all(small)), sort(all(toy));
    
    if(A==0){
        if(work(0,0,1) and work(1,1,1)) return 1;
        if(work(1,0,1) and work(1,1,1)) return 2;
        return -1;
    }
    else if(B==0){
        if(work(0,0,0) and work(1,1,0)) return 1;
        if(work(1,0,0) and work(1,1,0)) return 2;
        return -1;
    }
    else{
        if(work(0,0,0) and work(0,1,1)) return 1;
        if(work(0,0,1) and work(0,1,0)) return 1;
        if(work(0,0,0) and work(0,1,0)) return 2;
        if(work(0,0,1) and work(0,1,1)) return 2;
        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...