Submission #514938

#TimeUsernameProblemLanguageResultExecution timeMemory
514938AdamGSRobots (IOI13_robots)C++17
0 / 100
1 ms304 KiB
#include "robots.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
const int LIM=1e6+7;
int odw[LIM], akt;
int putaway(int A, int B, int n, int X[], int Y[], int W[], int S[]) {
	sort(X, X+A);
	sort(Y, Y+B);
	rep(i, n) if(W[i]>=X[A-1] && S[i]>=Y[B-1]) return -1;
	int p=0, ans=1;
	while(akt<n) {
		int ma=-1, l=-1;
		rep(j, n) if(!odw[j]) {
			if(p<A) {
				if(W[j]<X[p] && S[j]>ma) {
					ma=S[j];
					l=j;
				}
			} else {
				if(S[j]<Y[p-A] && W[j]>ma) {
					ma=W[j];
					l=j;
				}
			}
		}
		if(l!=-1) {
			odw[l]=1;
			++akt;
		}
		++p;
		if(p==A+B) {
			++ans;
			p=0;
		}
	}
	return ans;
}
#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...