QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#754074 | #9576. Ordainer of Inexorable Judgment | ucup-team4906# | Compile Error | / | / | C++20 | 4.9kb | 2024-11-16 14:10:37 | 2024-11-16 14:10:38 |
Judging History
你现在查看的是最新测评结果
- [2024-12-23 14:23:26]
- hack成功,自动添加数据
- (/hack/1303)
- [2024-12-06 11:32:56]
- hack成功,自动添加数据
- (/hack/1271)
- [2024-11-16 14:10:38]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-11-16 14:10:37]
- 提交
answer
#include<bits/stdc++.h>
#define F(i, a, b) for(int i = a; i <= b; i ++)
using namespace std;
using vi = vector<int>;
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define pii pair<int, int>
typedef long long ll;
typedef unsigned long long ull;
#define N 110
typedef double T;
typedef double db;
const db pi = acosl(-1);
const db eps = 1e-8;
int sgn(T x) {
if(fabs(x) < eps) return 0;
else return x < 0 ? -1 : 1;
}
struct point {
T x, y;
point() {}
point(T x, T y) : x(x), y(y) {}
point operator + (point B) const {return point(x + B.x, y + B.y);}
point operator - (point B) const {return point(x - B.x, y - B.y);}
point operator * (T k) const {return point(x * k, y * k);}
point operator / (T k) const {return point(x / k, y / k);}
bool operator == (point B) const {return sgn(x - B.x) == 0 && sgn(y - B.y) == 0;}
bool operator < (point B) const {return sgn(x - B.x) < 0 || (sgn(x - B.x) == 0 && sgn(y - B.y) < 0);}
T cross(point p) const {return x * p.y - y * p.x;}
int left(point p) const {return sgn(cross(p));}
T len() const {return sqrtl(x * x + y * y);}
point rot(long double cosr, long double sinr) {return point(x * cosr - y * sinr, x * sinr + y * cosr);}
};
T dot(point x) {return x.x * x.x + x.y * x.y;}
db dis(point A, point B) {return sqrtl((A.x - B.x) * (A.x - B.x) + (A.y - B.y) * (A.y - B.y));}
int get_region(point p) {
return sgn(p.y) < 0 ? -1 : sgn(p.y) > 0 | (sgn(p.y) == 0 & sgn(p.x) < 0);
}
bool cmp_arg(point a, point b) {
int p = get_region(a), q = get_region(b);
if(p != q) return p < q;
if(a.left(b) == 0) return dot(a) < dot(b);
return a.left(b) == 1;
}
int n, x0, y0, d, t;
point o(0, 0);
pair<point, point> tangent(const point a) {
point e = a; e = e / e.len() * d;
long double costh = d / dis(a, o), sinth = sqrtl(1 - costh * costh);
point t1 = o + e.rot(costh, -sinth), t2 = o + e.rot(costh, sinth);
// 两个切点
return {t1, t2};
}
bool cmp(pair<point, pair<point, int>> x1, pair<point, pair<point, int>> x2) {
return cmp_arg(x1.first, x2.first);
}
point rotate(point A, T rad) {
return point(A.x * cosl(rad) - A.y * sinl(rad), A.x * sinl(rad) + A.y * cosl(rad));
}
db dot(point A, point B) {return A.x * B.x + A.y * B.y;}
db len(point A) {return sqrtl(dot(A, A));}
db angle(point A, point B) {
db tmp = dot(A, B) / len(A) / len(B);
if(tmp > 1) tmp = 1;
else if(tmp < -1) tmp = -1;
db res = acosl(tmp);
// cout << res << "QAQ\n";
// cout << A.x << " " << A.y << " " << B.x << " " << B.y << " " << B.left(A) << "????\n";
if(B.left(A) == 1) res = 2 * pi - res;
return res;
}
void sol() {
cout << fixed << setprecision(10);
cin >> n >> x0 >> y0 >> d >> t;
vector<point> p;
vector<pair<point, pair<point, int>>> qaq;
F(i, 0, n - 1) {
int x, y; cin >> x >> y;
p.push_back(point(x, y));
auto [u, v] = tangent(point(x, y));
qaq.push_back({point(x, y) - u, {u, i}}), qaq.push_back({point(x, y) - v, {v, i}});
}
sort(qaq.begin(), qaq.end(), cmp);
point st, ed;
int cnt = 0;
for(int i = 0; i < qaq.size(); i ++) if(qaq[i].first.left(qaq[(i + 1) % qaq.size()].first) == -1) {
cnt ++;
point u = qaq[(i + 1) % qaq.size()].second.first;
point v = qaq[i].second.first;
// cout << u.x << " " << u.y << "!!!\n";
// cout << v.x << " " << v.y << "???\n";
st = rotate(u, pi * 1.5), ed = rotate(v, pi / 2.0);
// st = rotate(u, pi / 2.0), ed = rotate(v, pi * 1.5);
}
assert(cnt == 1);
point S(x0, y0);
S = S / S.len() * d;
// cout << st.x << " " << st.y << "??\n";
// cout << ed.x << " " << ed.y << "??\n";
// cout << S.x << " " << S.y << "!!\n";
int l = 0, r = 100000;
while(l < r) {
int mid = l + r + 1 >> 1;
if(sgn(mid * 2.0 * pi - t) <= 0) l = mid;
else r = mid - 1;
}
// cout << l << "???\n";
// cout << l << "Q\n";
// cout << angle(st, ed) << "::\n";
long double res = angle(st, ed) * l;
// cout << res << "!!\n";
t -= l * (2.0 * pi);
if(S.left(st) > 0 && ed.left(S) > 0) {
if(sgn(t - angle(S, ed)) <= 0) res += t;
else {
t -= angle(S, ed);
res += angle(S, ed);
if(sgn(t - angle(ed, st)) > 0) {
res += t - angle(ed, st);
}
}
} else {
// cout << ">>\n";
if(sgn(t - angle(S, st)) > 0) {
t -= angle(S, st);
if(sgn(t - angle(st, ed)) > 0) res += angle(st, ed);
else res += t;
}
}
cout << res << '\n';
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T = 1;
// cin >> T;
while (T --) sol();
return 0;
}
/*
3 1 0 1 1
1 2
2 1
2 2
3 1 0 1 2
1 2
2 1
2 2
3 1 0 1 10000
1 2
2 1
2 2
*/
详细
answer.code:49:12: error: ‘int y0’ redeclared as different kind of entity 49 | int n, x0, y0, d, t; | ^~ In file included from /usr/include/features.h:461, from /usr/include/x86_64-linux-gnu/c++/13/bits/os_defines.h:39, from /usr/include/x86_64-linux-gnu/c++/13/bits/c++config.h:679, from /usr/include/c++/13/cassert:43, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:33, from answer.code:1: /usr/include/x86_64-linux-gnu/bits/mathcalls.h:220:1: note: previous declaration ‘double y0(double)’ 220 | __MATHCALL (y0,, (_Mdouble_)); | ^~~~~~~~~~ answer.code: In function ‘void sol()’: answer.code:79:20: error: no match for ‘operator>>’ (operand types are ‘std::basic_istream<char>::__istream_type’ {aka ‘std::basic_istream<char>’} and ‘double(double) noexcept’) 79 | cin >> n >> x0 >> y0 >> d >> t; | ~~~~~~~~~~~~~~ ^~ ~~ | | | | | double(double) noexcept | std::basic_istream<char>::__istream_type {aka std::basic_istream<char>} In file included from /usr/include/c++/13/sstream:40, from /usr/include/c++/13/complex:45, from /usr/include/c++/13/ccomplex:39, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:127: /usr/include/c++/13/istream:325:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(void*&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 325 | operator>>(void*& __p) | ^~~~~~~~ /usr/include/c++/13/istream:325:7: note: conversion of argument 1 would be ill-formed: answer.code:79:23: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘void*’ [-fpermissive] 79 | cin >> n >> x0 >> y0 >> d >> t; | ^~ | | | double (*)(double) noexcept answer.code:79:23: error: cannot bind rvalue ‘(void*)y0’ to ‘void*&’ /usr/include/c++/13/istream:201:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 201 | operator>>(unsigned long long& __n) | ^~~~~~~~ /usr/include/c++/13/istream:201:7: note: conversion of argument 1 would be ill-formed: answer.code:79:23: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘long long unsigned int’ [-fpermissive] 79 | cin >> n >> x0 >> y0 >> d >> t; | ^~ | | | double (*)(double) noexcept answer.code:79:23: error: cannot bind rvalue ‘(long long unsigned int)y0’ to ‘long long unsigned int&’ /usr/include/c++/13/istream:197:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 197 | operator>>(long long& __n) | ^~~~~~~~ /usr/include/c++/13/istream:197:7: note: conversion of argument 1 would be ill-formed: answer.code:79:23: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘long long int’ [-fpermissive] 79 | cin >> n >> x0 >> y0 >> d >> t; | ^~ | | | double (*)(double) noexcept answer.code:79:23: error: cannot bind rvalue ‘(long long int)y0’ to ‘long long int&’ /usr/include/c++/13/istream:192:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long unsigned int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 192 | operator>>(unsigned long& __n) | ^~~~~~~~ /usr/include/c++/13/istream:192:7: note: conversion of argument 1 would be ill-formed: answer.code:79:23: error: invalid conversion from ‘double (*)(double) noexcept’ to ‘long unsigned int’ [-fpermissive] 79 | cin >> n >> x0 >> y0 >> d >> t; | ^~ | | | double (*)(double) noexcept answer.code:79:23: error: cannot bind rvalue ‘(long unsigned int)y0’ to ‘long unsigned int&’ /usr/include/c++/13/istream:188:7: note: candidate: ‘std::basic_istream<_CharT, _Traits>::__istream_type& std::basic_istream<_CharT, _Traits>::operator>>(long int&) [with _CharT = char; _Traits = std::char_traits<char>; __istream_type = std::basic_istream<char>]’ (near match) 188 | operator>>(long& __n) | ^~~~~~~~ /usr/include/c++/13/istream:188:7: note: conversio...