Submission #652622

# Submission time Handle Problem Language Result Execution time Memory
652622 2022-10-23T14:28:57 Z blue Hamburg Steak (JOI20_hamburg) C++17
6 / 100
88 ms 11204 KB
#include <bits/stdc++.h>
using namespace std;

using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vpii = vector<pii>;
using vvpii = vector<vpii>;

const int mx = 200'000;
const int inf = 2'000'000'000;

int N, K;

vi X1, X2, Y1, Y2;

bool check(int x, int y, int r)
{
	return X1[r] <= x && x <= X2[r] && Y1[r] <= y && y <= Y2[r];
}

bool check(vi x, vi y)
{
	for(int i = 0; i < N; i++)
	{
		bool works = 0;
		for(int j = 0; j < K; j++)
		{
			if(check(x[j], y[j], i))
				works = 1;
		}
		if(!works)
			return 0;
	}
	return 1;
}

void answer(vi x, vi y)
{
	for(int k = 0; k < K; k++)
	{
		cout << x[k] << ' ' << y[k] << '\n';
	}
}

int max(vi& A)
{
	int res = -inf;
	for(int a : A)
		res = max(res, a);
	return res;
}

int min(vi& A)
{
	int res = inf;
	for(int a : A)
		res = min(res, a);
	return res;
}



int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	cin >> N >> K;
	X1 = X2 = Y1 = Y2 = vi(N);
	for(int i = 0; i < N; i++)
	{
		cin >> X1[i] >> Y1[i] >> X2[i] >> Y2[i];
	}

	if(check({max(X1), min(X2)}, {max(Y1), min(Y2)}))
	{
		// cerr << "hello\n";
		answer({max(X1), min(X2)}, {max(Y1), min(Y2)});
	}
	else
	{
		// cerr << "world\n";
		answer({max(X1), min(X2)}, {min(Y2), max(Y1)});
	}
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 1 ms 432 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 328 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Integer parameter [name=x_3] equals to 0, violates the range [1, 10^9]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 468 KB Integer parameter [name=x_3] equals to 0, violates the range [1, 10^9]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 1 ms 432 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 88 ms 11084 KB Output is correct
6 Correct 84 ms 11132 KB Output is correct
7 Correct 80 ms 11136 KB Output is correct
8 Correct 82 ms 11084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 328 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 86 ms 11116 KB Output is correct
6 Correct 83 ms 11124 KB Output is correct
7 Correct 83 ms 11204 KB Output is correct
8 Correct 81 ms 11084 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Integer parameter [name=x_3] equals to 0, violates the range [1, 10^9]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 468 KB Integer parameter [name=x_3] equals to 0, violates the range [1, 10^9]
2 Halted 0 ms 0 KB -