QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#533964#2434. Single Cut of FailurekarunaWA 1ms4024kbC++201.6kb2024-08-26 17:42:022024-08-26 17:42:02

Judging History

你现在查看的是最新测评结果

  • [2024-08-26 17:42:02]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4024kb
  • [2024-08-26 17:42:02]
  • 提交

answer

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#define ff first
#define ss second
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int main() {
	cin.tie(0); ios_base::sync_with_stdio(0);
	int n, W, H;
	cin >> n >> W >> H;
	W *= 2;
	H *= 2;
	auto f = [&](int x, int y) {
		if (y == 0) return x;
		else if (x == W) return W + y;
		else if (y == H) return 2 * W + H - x;
		else return 2 * W + 2 * H - y;
	};
	auto g = [&](int x) {
		if (x <= W) return pii{x, 0};
		else if (x <= W + H) return pii{W, x - W};
		else if (x <= W + H + W) return pii{2 * W + H - x, H};
		else return pii{0, 2 * W + 2 * H - x};
	};
	vector<pii> a;
	for (int i = 0; i < n; i++) {
		int x, y;
		cin >> x >> y;
		x *= 2; y *= 2;
		a.push_back({f(x, y), i});
		cin >> x >> y;
		x *= 2; y *= 2;
		a.push_back({f(x, y), i});
	}
	sort(a.begin(), a.end());
	int cnt[n]{};
	for (int i = 0, p = 0; i < 2 * n; i++) {
		while (p < 2 * n && !cnt[a[p].ss]) {
			cnt[a[p++].ss]++;
		}
		if (p - i == n) {
			int x = a[i].ff - 1;
			int y = a[p % (2 * n)].ff - 1;
			pii p = g(x);
			pii q = g(y);
			cout << 1 << '\n';
			cout << p.ff * 0.5 << ' ' << p.ss * 0.5 << ' ' << q.ff * 0.5 << ' ' << q.ss * 0.5 << '\n';
			return 0;
		}
		--cnt[a[i].ss];
	}
	pii p = g(W + 1);
	pii q = g(W + H - 1);
	pii r = g(2 * W + H + 1);
	pii s = g(2 * W + 2 * H - 1);
	cout << 2 << '\n';
	cout << p.ff * 0.5 << ' ' << p.ss * 0.5 << ' ' << r.ff * 0.5 << ' ' << r.ss * 0.5 << '\n';
	cout << q.ff * 0.5 << ' ' << q.ss * 0.5 << ' ' << s.ff * 0.5 << ' ' << s.ss * 0.5 << '\n';
}

Details

Test #1:

score: 100
Accepted
time: 1ms
memory: 3804kb

Test #2:

score: 0
Accepted
time: 0ms
memory: 3724kb

Test #3:

score: 0
Accepted
time: 0ms
memory: 4024kb

Test #4:

score: 0
Accepted
time: 1ms
memory: 3776kb

Test #5:

score: 0
Accepted
time: 0ms
memory: 3784kb

Test #6:

score: -100
Wrong Answer
time: 0ms
memory: 3848kb