Submission #386616

#TimeUsernameProblemLanguageResultExecution timeMemory
386616milleniumEeeeRobots (IOI13_robots)C++17
0 / 100
163 ms9400 KiB
#include <bits/stdc++.h>
#include "robots.h"
//#include "grader.cpp"
#define fr first
#define sc second
#define pb push_back
#define mk make_pair
using namespace std;

#define chkmax(a, b) a = max(a, b)
#define chkmin(a, b) a = min(a, b)

int a, b, t;
const int MAXN = (int)1e6 + 6;
int x[MAXN], y[MAXN], w[MAXN], s[MAXN];

int putaway(int AA, int BB, int TT, int XX[], int YY[], int WW[], int SS[]) {
	a = AA;
	b = BB;
	t = TT;
	for (int i = 0; i < a; i++) {
		x[i] = XX[i];
	}
	for (int i = 0; i < b; i++) {
		y[i] = YY[i];
	}
	for (int i = 0; i < t; i++) {
		w[i] = WW[i];
		y[i] = YY[i];
	}
	int max_x = 0;
	for (int i = 0; i < a; i++) {
		chkmax(max_x, x[i]);
	}
	int max_y = 0;
	for (int i = 0; i < b; i++) {
		chkmax(max_y, y[i]);
	}
	for (int i = 0; i < t; i++) {
		if (w[i] < max_x) {
			continue;
		}
		else if (s[i] < max_y) {
			continue;
		}
		else {
			return -1;
		}
	}
	auto can = [&](pair<int, char> robot, int pos) {
		if (robot.sc == 'A') {
			return w[pos] < robot.fr;
		} else {
			return w[pos] < robot.fr;
		}
	};
	vector <pair<int, char>> vec;
	for (int i = 0; i < a; i++) {
		vec.pb(mk(x[i], 'A'));
	}
	for (int i = 0; i < b; i++) {
		vec.pb(mk(y[i], 'B'));
	}
	if (can(vec[0], 0) && can(vec[1], 1)) {
		return 1;
	}
	if (can(vec[1], 0) && can(vec[0], 1)) {
		return 1;
	}
	return 2;
}
#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...