QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#167867 | #2434. Single Cut of Failure | PetroTarnavskyi | WA | 1ms | 3928kb | C++17 | 2.0kb | 2023-09-07 17:56:37 | 2023-09-07 17:56:37 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (a) - 1; i >= (b); i--)
#define FILL(a, b) memset(a, b, sizeof(a))
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;
int w, h;
int coor[4];
int f(int x, int y)
{
if (y == 0) return x;
if (x == w) return w + y;
if (y == h) return w + h + (w - x);
if (x == 0) return w + h + w + (h - y);
assert(0);
}
int getSide(int x)
{
return lower_bound(coor, coor + 4, x) - coor;
}
PII g(int x)
{
if (x < coor[0]) return {x, 0};
if (x < coor[1]) return {w, x - w};
if (x < coor[2]) return {w - (x - (coor[1])), h};
if (x < coor[3]) return {0, h - (x - coor[2])};
assert(0);
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n >> w >> h;
w *= 2;
h *= 2;
coor[0] = w;
coor[1] = w + h;
coor[2] = w + h + w;
coor[3] = w + h + w + h;
vector<PII> v;
FOR (i, 0, n)
{
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
v.PB({f(x1 * 2, y1 * 2), i});
v.PB({f(x2 * 2, y2 * 2), i});
}
sort(ALL(v));
VI used(n, 0);
int l = 0;
FOR (r, 0, 2 * n)
{
while (l < r && used[v[r].S])
{
used[v[l++].S] = 0;
}
used[v[r].S] = 1;
if (r - l + 1 == n)
{
int c1 = v[l].F - 1;
int c2 = v[r].F + 1;
if (getSide(c1) == getSide(c2))
{
c2 = (coor[getSide(c2)] + 1) % (2 * (h + w));
}
cout << 1 << '\n';
PII p = g(c1);
cout << p.F / 2.0 << ' ' << p.S / 2.0 << ' ';
p = g(c2);
cout << p.F / 2.0 << ' ' << p.S / 2.0 << '\n';
return 0;
}
}
w /= 2;
h /= 2;
cout << 2 << '\n';
cout << 0.5 << ' ' << 0 << ' ' << w - 0.5 << ' ' << h << '\n';
cout << 0 << ' ' << h - 0.5 << ' ' << w << ' ' << 0.5 << '\n';
return 0;
}
Details
Test #1:
score: 100
Accepted
time: 0ms
memory: 3924kb
Test #2:
score: 0
Accepted
time: 1ms
memory: 3704kb
Test #3:
score: 0
Accepted
time: 1ms
memory: 3732kb
Test #4:
score: 0
Accepted
time: 1ms
memory: 3928kb
Test #5:
score: 0
Accepted
time: 1ms
memory: 3772kb
Test #6:
score: -100
Wrong Answer
time: 1ms
memory: 3700kb