QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#128056 | #142. 平面最近点对 | 1234567890# | Compile Error | / | / | C++14 | 1.7kb | 2023-07-20 15:14:43 | 2023-07-20 15:14:45 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-07-20 15:14:45]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-07-20 15:14:43]
- 提交
answer
/*
灏忓簾鐗╋紝杩欓兘涓嶄細 /cf
*/
#include <bits/stdc++.h>
using namespace std;
#define ll __int128
#define mp make_pair
#define inf (ll)1e9
#define pii pair <ll, ll>
#define fr first
#define se second
const ll mod = 1e9 + 7;
char buf[1 << 21], *p1 = buf, *p2 = buf;
#define getchar() (p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 18, stdin), p1 == p2) ? EOF : *p1++)
inline ll read() {
ll x = 0, f = 1;
char ch = getchar();
while(ch < '0' || ch > '9') f = ((ch == '-') ? -1 : f), ch = getchar();
while(ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
return x * f;
}
inline void write(ll x) {
if(x < 0) x = -x, putchar('-');
if(x >= 10) write(x / 10);
putchar(x % 10 + '0');
}
inline ll Dis(pii x, pii y) {
return (x.fr - y.fr) * (x.fr - y.fr) + (x.se - y.se) * (x.se - y.se);
}
ll n;
pii a[2000005];
set <pii> S;
int main() {
// freopen(".in", "r", stdin);
// freopen(".out", "w", stdout);
n = read();
for(ll i = 1; i <= n; i++) a[i].fr = read(), a[i].se = read();
sort(a + 1, a + 1 + n);
for(ll i = 1; i <= n; i++) swap(a[i].fr, a[i].se);
ll d = Dis(a[1], a[2]);
S.insert(a[1]), S.insert(a[2]);
for(ll i = 3, j = 1; i <= n; i++) {
// printf("!! %lld\n", i);
while(j < i && (a[j].se - a[i].se) * (a[j].se - a[i].se) >= d) S.erase(a[j++]);
auto it = S.lower_bound(mp(a[i].fr, 0ll));
while(it != S.end()) {
if(a[j].fr - a[i].fr) * (a[j].fr - a[i].fr) >= d) break;
d = min(d, Dis((*it), a[i])), it++;
}
while(it != S.begin()) {
it--;
if(a[j].fr - a[i].fr) * (a[j].fr - a[i].fr) >= d) break;
d = min(d, Dis((*it), a[i]));
}
S.insert(a[i]);
}
printf("%.12Lf", sqrtl(d));
return 0;
}
/*
*/
詳細信息
answer.code: In function ‘int main()’: answer.code:47:47: error: invalid type argument of unary ‘*’ (have ‘__int128’) 47 | if(a[j].fr - a[i].fr) * (a[j].fr - a[i].fr) >= d) break; | ^~~~~~~~~~~~~~~~~~~~~ answer.code:52:47: error: invalid type argument of unary ‘*’ (have ‘__int128’) 52 | if(a[j].fr - a[i].fr) * (a[j].fr - a[i].fr) >= d) break; | ^~~~~~~~~~~~~~~~~~~~~