QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#168012 | #2434. Single Cut of Failure | PetroTarnavskyi | AC ✓ | 2782ms | 135916kb | C++17 | 2.4kb | 2023-09-07 19:47:06 | 2023-09-07 19:47:07 |
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); 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 f(int x, int y)
{
if (x == 0) return 2 * y;
if (y == h) return 2 * (h + x);
if (x == w) return 2 * (h + w + h - y);
return 2 * (h + h + w + w - x);
}
int getSide(int c)
{
if (c < 2 * h) return 0;
if (c < 2 * (h + w)) return 1;
if (c < 2 * (h + w + h)) return 2;
if (c < 2 * (h + w + h + w)) return 3;
assert(0);
}
void g(int c)
{
if (c < 2 * h) cout << 0 << ' ' << h - (c / 2.0);
else if (c < 2 * (h + w)) cout << (c - 2 * h) / 2.0 << ' ' << 0;
else if (c < 2 * (h + w + h)) cout << w << ' ' << (c - 2 * (h + w)) / 2.0;
else if (c < 2 * (h + w + h + w)) cout << w - (c - 2 * (h + w + h)) / 2.0 << ' ' << h;
else
assert(0);
}
int coor[4];
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout << fixed << setprecision(1);
int n;
cin >> n >> w >> h;
coor[0] = h;
coor[1] = h + w;
coor[2] = h + w + h;
coor[3] = 0;
vector<PII> v(2 * n);
vector<VI> mn(n);
FOR (i, 0, n)
{
int x1, y1, x2, y2;
cin >> x1 >> y1 >> x2 >> y2;
y1 = h - y1;
y2 = h - y2;
v[2 * i] = {f(x1, y1), i};
v[2 * i + 1] = {f(x2, y2), i};
}
sort(ALL(v));
FOR (i, 0, 2 * n)
{
v.PB(v[i]);
mn[v[i].S].PB(i);
mn[v[i].S].PB(i + 2 * n);
}
FOR (i, 0, n)
sort(ALL(mn[i]), greater());
set<int> mnpos;
FOR (i, 0, n)
mnpos.insert(mn[i].back());
FOR (i, 0, 2 * n)
{
if (*mnpos.rbegin() - i == n - 1)
{
int c1 = v[i].F - 1;
int c2 = v[i + n - 1].F + 1;
if (getSide(c1) == getSide(c2))
c2 = 2 * coor[getSide(c2)] + 1;
cout << 1 << '\n';
g(c1);
cout << ' ';
g(c2);
cout << '\n';
return 0;
}
else
{
int j = v[i].S;
mnpos.erase(mn[j].back());
mn[j].pop_back();
if (mn[j].empty())
break;
mnpos.insert(mn[j].back());
}
}
cout << 2 << '\n';
cout << 0.5 << ' ' << 0 << ' ' << w - 0.5 << ' ' << h << '\n';
cout << 0 << " " << h - 0.5 << ' ' << w << ' ' << 0.5 << '\n';
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3712kb
Test #2:
score: 0
Accepted
time: 0ms
memory: 3900kb
Test #3:
score: 0
Accepted
time: 1ms
memory: 3932kb
Test #4:
score: 0
Accepted
time: 1ms
memory: 3712kb
Test #5:
score: 0
Accepted
time: 0ms
memory: 3984kb
Test #6:
score: 0
Accepted
time: 1ms
memory: 3932kb
Test #7:
score: 0
Accepted
time: 1ms
memory: 4000kb
Test #8:
score: 0
Accepted
time: 1ms
memory: 3776kb
Test #9:
score: 0
Accepted
time: 227ms
memory: 36364kb
Test #10:
score: 0
Accepted
time: 187ms
memory: 36264kb
Test #11:
score: 0
Accepted
time: 203ms
memory: 36252kb
Test #12:
score: 0
Accepted
time: 200ms
memory: 36664kb
Test #13:
score: 0
Accepted
time: 222ms
memory: 36500kb
Test #14:
score: 0
Accepted
time: 345ms
memory: 36300kb
Test #15:
score: 0
Accepted
time: 333ms
memory: 36536kb
Test #16:
score: 0
Accepted
time: 208ms
memory: 36292kb
Test #17:
score: 0
Accepted
time: 353ms
memory: 36348kb
Test #18:
score: 0
Accepted
time: 260ms
memory: 36440kb
Test #19:
score: 0
Accepted
time: 341ms
memory: 36232kb
Test #20:
score: 0
Accepted
time: 229ms
memory: 36384kb
Test #21:
score: 0
Accepted
time: 342ms
memory: 36284kb
Test #22:
score: 0
Accepted
time: 232ms
memory: 36388kb
Test #23:
score: 0
Accepted
time: 272ms
memory: 36376kb
Test #24:
score: 0
Accepted
time: 1943ms
memory: 135916kb
Test #25:
score: 0
Accepted
time: 2647ms
memory: 135908kb
Test #26:
score: 0
Accepted
time: 0ms
memory: 3772kb
Test #27:
score: 0
Accepted
time: 1ms
memory: 3800kb
Test #28:
score: 0
Accepted
time: 1ms
memory: 3804kb
Test #29:
score: 0
Accepted
time: 2ms
memory: 4268kb
Test #30:
score: 0
Accepted
time: 31ms
memory: 6612kb
Test #31:
score: 0
Accepted
time: 2438ms
memory: 117960kb
Test #32:
score: 0
Accepted
time: 2782ms
memory: 135916kb
Test #33:
score: 0
Accepted
time: 0ms
memory: 3856kb
Test #34:
score: 0
Accepted
time: 1ms
memory: 4012kb
Test #35:
score: 0
Accepted
time: 0ms
memory: 3896kb
Test #36:
score: 0
Accepted
time: 7ms
memory: 4396kb
Test #37:
score: 0
Accepted
time: 23ms
memory: 6680kb
Test #38:
score: 0
Accepted
time: 172ms
memory: 27548kb
Test #39:
score: 0
Accepted
time: 1392ms
memory: 135868kb
Test #40:
score: 0
Accepted
time: 1ms
memory: 3824kb
Test #41:
score: 0
Accepted
time: 1ms
memory: 3784kb
Test #42:
score: 0
Accepted
time: 1ms
memory: 3752kb
Test #43:
score: 0
Accepted
time: 7ms
memory: 4492kb
Test #44:
score: 0
Accepted
time: 83ms
memory: 12940kb
Test #45:
score: 0
Accepted
time: 1271ms
memory: 93312kb
Test #46:
score: 0
Accepted
time: 2161ms
memory: 135888kb
Test #47:
score: 0
Accepted
time: 1ms
memory: 3760kb
Test #48:
score: 0
Accepted
time: 0ms
memory: 3760kb
Test #49:
score: 0
Accepted
time: 1ms
memory: 3796kb
Test #50:
score: 0
Accepted
time: 2ms
memory: 3820kb
Test #51:
score: 0
Accepted
time: 2ms
memory: 3772kb
Test #52:
score: 0
Accepted
time: 2ms
memory: 3768kb
Test #53:
score: 0
Accepted
time: 0ms
memory: 3828kb
Test #54:
score: 0
Accepted
time: 2ms
memory: 3768kb
Test #55:
score: 0
Accepted
time: 2ms
memory: 3756kb
Test #56:
score: 0
Accepted
time: 2ms
memory: 3992kb
Test #57:
score: 0
Accepted
time: 2ms
memory: 3992kb
Test #58:
score: 0
Accepted
time: 2ms
memory: 3992kb
Test #59:
score: 0
Accepted
time: 2ms
memory: 3928kb
Test #60:
score: 0
Accepted
time: 2ms
memory: 3708kb
Test #61:
score: 0
Accepted
time: 2ms
memory: 3756kb
Test #62:
score: 0
Accepted
time: 0ms
memory: 3932kb
Test #63:
score: 0
Accepted
time: 1ms
memory: 3768kb
Test #64:
score: 0
Accepted
time: 1ms
memory: 3860kb
Test #65:
score: 0
Accepted
time: 0ms
memory: 3708kb
Test #66:
score: 0
Accepted
time: 1ms
memory: 3988kb
Test #67:
score: 0
Accepted
time: 1ms
memory: 3704kb
Test #68:
score: 0
Accepted
time: 1ms
memory: 3896kb
Test #69:
score: 0
Accepted
time: 0ms
memory: 3752kb
Test #70:
score: 0
Accepted
time: 0ms
memory: 3768kb
Test #71:
score: 0
Accepted
time: 39ms
memory: 16328kb
Test #72:
score: 0
Accepted
time: 49ms
memory: 16396kb
Test #73:
score: 0
Accepted
time: 51ms
memory: 16368kb
Test #74:
score: 0
Accepted
time: 76ms
memory: 16352kb
Test #75:
score: 0
Accepted
time: 44ms
memory: 16348kb
Test #76:
score: 0
Accepted
time: 1ms
memory: 3740kb