QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#722106 | #9576. Ordainer of Inexorable Judgment | red# | WA | 0ms | 4292kb | C++20 | 2.6kb | 2024-11-07 17:51:06 | 2024-11-07 17:51:07 |
Judging History
你现在查看的是最新测评结果
- [2024-12-23 14:23:26]
- hack成功,自动添加数据
- (/hack/1303)
- [2024-12-06 11:32:56]
- hack成功,自动添加数据
- (/hack/1271)
- [2024-11-14 21:58:28]
- hack成功,自动添加数据
- (/hack/1181)
- [2024-11-07 17:51:06]
- 提交
answer
#include<bits/stdc++.h>
#define IOS std::ios::sync_with_stdio(false);std::cin.tie(0);std::cout.tie(0);
using namespace std;
#define INF 0x3f3f3f3f
#define endl '\n'
#define int long long
#define db double
using pll = std::pair<int, int>;
const db phi = acos(-1.0);
struct P {
db x, y;
P() {}
P(db _x, db _y) : x(_x), y(_y) {}
P operator+(P p) { return {x + p.x, y + p.y}; }
P operator-(P p) { return {x - p.x, y - p.y}; }
P operator*(db d) { return {x * d, y * d}; }
P operator/(db d) { return {x / d, y / d}; }
db dot(P p) { return x * p.x + y * p.y; }
db det(P p) { return x * p.y - y * p.x; }
db distTo(P p) { return (*this-p).abs(); }
db alpha() { return atan2(y, x); }
db abs() { return sqrt(abs2());}
db abs2() { return x * x + y * y; }
P rot90() { return P(-y,x);}
P unit() { return *this/abs(); }
P rot(db an){ return {x*cos(an) - y*sin(an),x*sin(an) + y*cos(an)}; }
};
struct C
{
P c;
db r;
P point(db a) {return P(c.x + cos(a) * r, c.y + sin(a) * r);}
};
void tp(P p, P o, db r, P& p1, P& p2) {
db line = p.distTo(o);
db ang = acos(r / line);
P u, l;
l = p - o;
u.x = l.x / l.abs() * r;
u.y = l.y / l.abs() * r;
p1 = u.rot(-ang);
p2 = u.rot(ang);
p1 = p1 + o;
p2 = p2 + o;
}
void solv(){
int n;
db d, t;
C o;
db x0, y0;
cin >> n >> x0 >> y0 >> o.r >> t;
o.c.x = o.c.y = 0;
vector<P> e;
for (int i = 1;i <= n;i++) {
P t;
cin >> t.x >> t.y;
P p1, p2;
tp(t, o.c, o.r, p1, p2);
e.push_back(t-p1);
e.push_back(t-p2);
}
db tmp=-1;
P ii, jj;
for (P i : e) {
for (P j : e) {
db num = i.dot(j) / i.abs() / j.abs();
if (tmp == -1) tmp = num, ii = i, jj = j;
else if (tmp > num) tmp = num, ii = i, jj = j;
}
}
db ans = 0;
//cout << ii.x << " " << ii.y << endl;
//cout << jj.x << " " << jj.y << endl;
while (t >= 2.0 * phi) {
t -= 2.0 * phi;
ans = ans + acos(ii.dot(jj) / ii.abs() / jj.abs());
}
db a = ii.alpha(), b = jj.alpha();
//cout << a << " " << b << endl;
if (a < 0) a = a + 2.0 * phi;
if (b < 0) b = b + 2.0 * phi;
if (a > b) swap(a, b);
db x = P(x0, y0).alpha();
db y = y + t;
ans = ans + max(min(y, b) - max(a, x), 0.0);
cout << fixed << setprecision(16) << ans << endl;
}
signed main(){
//#ifdef LOCAL
// freopen("in.txt","r",stdin);
// freopen("out.txt","w",stdout);
//#endif
IOS;
int T=1;
//cin >> T;
while (T--){
solv();
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 4280kb
input:
3 1 0 1 1 1 2 2 1 2 2
output:
1.0000000000000000
result:
ok found '1.0000000', expected '1.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 4228kb
input:
3 1 0 1 2 1 2 2 1 2 2
output:
1.5707963267948966
result:
ok found '1.5707963', expected '1.5707963', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 4292kb
input:
3 1 0 1 10000 1 2 2 1 2 2
output:
2500.7077522574977593
result:
ok found '2500.7077523', expected '2500.7077523', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 4264kb
input:
3 10000 10000 1 10000 10000 9999 10000 10000 9999 10000
output:
0.3842412998819770
result:
ok found '0.3842413', expected '0.3842413', error '0.0000000'
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 4260kb
input:
3 -10000 -10000 10000 10000 -10000 -9999 -10000 -10000 -9999 -10000
output:
2499.7658554697923137
result:
wrong answer 1st numbers differ - expected: '2500.2406700', found: '2499.7658555', error = '0.0001899'