QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#47445 | #4383. Laser | miaomiaozi | AC ✓ | 65ms | 4912kb | C++17 | 2.0kb | 2022-09-09 20:25:50 | 2022-09-09 20:25:52 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
// https://space.bilibili.com/672346917
#ifndef LOCAL
#define LOG(...) 42
#endif
#define fi first
#define se second
#define pb push_back
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long LL;
typedef pair <LL, LL> PII;
constexpr int inf = 0x3f3f3f3f;
constexpr double EPS = 1e-8;
const double PI = acos(-1);
int multi_cases = 1;
void A_SOUL_AvA () {
int n;
cin >> n;
vector <PII> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i].fi >> a[i].se;
a[i].fi += a[i].fi;
a[i].se += a[i].se;
}
auto chk = [&](PII p) {
auto [x, y] = p;
for (int i = 0; i < n; i++) {
auto [u, v] = a[i];
if (u == x || v == y || abs(x - u) == abs(y - v)) continue;
return i;
}
return -1;
};
int pos = chk(a[0]);
LOG(pos);
vector <PII> query;
auto gao = [&](PII u, PII v) {
auto [a, b] = u;
auto [c, d] = v;
query.pb({c, b});
query.pb({b + c - d, b});
query.pb({c + d - b, b});
query.pb({a, d});
query.pb({a, a + d - c});
query.pb({a, c + d - a});
query.pb({a + d - b, d});
query.pb({c, c + b - a});
query.pb({a + (b - a + c + d) / 2 - b, (b - a + c + d) / 2});
query.pb({a + b - d, d});
query.pb({c, a + b - c});
query.pb({a + b - (a + b + d - c) / 2, (a + b + d - c) / 2});
};
gao(a[0], a[pos]);
int ok = 0;
for (auto p : query) {
if (chk(p) == -1) {
ok = 1;
}
}
cout << (ok ? "YES" : "NO") << endl;
}
int main () {
cin.tie(nullptr)->sync_with_stdio(false);
cout << fixed << setprecision(12);
int T = 1;
for (multi_cases && cin >> T; T; T--) {
A_SOUL_AvA ();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 65ms
memory: 4912kb
input:
116 4 -10 0 10 0 5 5 -5 -5 4 -10 0 10 0 0 10 0 -10 4 -1 0 1 0 2 0 3 0 4 0 1 0 2 0 3 0 4 4 100 100 10000 10000 100000 100000 -100 -100 4 -100 100 -10000 10000 -100000 100000 100 -100 6 1 1 1 3 2 2 3 1 3 3 3 4 7 1 1 1 3 2 2 3 1 3 3 1 4 3 4 4 1236833 14678 1232056 9901 1237055 9790 1231834 15011 4 1236...
output:
YES YES YES YES YES YES YES NO YES NO NO YES NO NO YES YES NO NO YES YES YES YES YES YES NO YES YES YES YES YES YES YES NO YES YES NO NO YES NO NO NO YES YES YES NO NO YES YES NO NO NO NO NO YES YES NO YES NO NO YES NO YES NO NO NO NO YES YES YES NO YES YES YES NO YES YES NO YES NO YES YES NO YES NO...
result:
ok 116 lines