QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#730269 | #9576. Ordainer of Inexorable Judgment | Zagreb Oblutci (Krešimir Nežmah, Dorijan Lendvaj, Patrick Pavić)# | WA | 0ms | 4020kb | C++23 | 1.8kb | 2024-11-09 19:30:54 | 2024-11-09 19:30:54 |
Judging History
This is the latest submission verdict.
- [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-09 19:30:54]
- Submitted
answer
#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
using ll=long long;
using ld=long double;
using pii=pair<int,int>;
using vi=vector<int>;
using vl=vector<ll>;
#define pb push_back
#define all(a) begin(a),end(a)
const int N=300010,MOD=1e9+7;
const char en='\n';
const ll LLINF=1ll<<60;
const ld PI = acos(-1);
int n, x0, yy0, d, t;
vector < pii > toc;
ld normaliziraj(ld start, ld sad) {
sad -= start;
while(sad < 0) sad += 2 * PI;
while(sad >= 2 * PI) sad -= 2 * PI;
return sad;
}
ld sijeku(ld l1, ld r1, ld l2, ld r2) {
return max((ld)0.0, min(r1, r2) - max(l1, l2));
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n >> x0 >> yy0 >> d >> t;
for(int i = 0;i < n;i++) {
int x, y; cin >> x >> y;
toc.pb({x, y});
}
ld poc = 0;
for(int i = 0;i < n;i++) {
int j = (i + 1) % n;
if(toc[i].y >= -2 * d && toc[i].y <= 2 * d) {
poc = acos(-1);
}
if((toc[i].y <= 0 && toc[j].y >= 0) ||
(toc[i].y >= 0 && toc[j].y <= 0)) {
poc = acos(-1);
}
}
ld prvi = 1e9, zadnji = -1e9;
for(int i = 0;i < n;i++) {
ld delta = asin((ld)d / sqrt((ld)toc[i].x * toc[i].x + (ld)toc[i].y * toc[i].y));
ld ang = atan2((ld)toc[i].y, (ld)toc[i].x);
prvi = min(prvi, normaliziraj(poc, ang - delta));
zadnji = max(zadnji, normaliziraj(poc, ang + delta));
}
cout << fixed << setprecision(12);
ld ja = normaliziraj(poc, atan2((ld)yy0, (ld)x0));
ld puni = floor(t / (2 * PI));
ld ost = t - puni * 2 * PI;
ld ans = 0;
ans += (zadnji - prvi) * puni;
ld aa = ja + ost;
if(aa > 2 * PI) {
aa -= 2 * PI;
ans += sijeku(prvi, zadnji, 0, aa) + sijeku(prvi, zadnji, ja, 2 * PI);
} else {
ans += sijeku(prvi, zadnji, ja, aa);
}
cout << ans << endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3964kb
input:
3 1 0 1 1 1 2 2 1 2 2
output:
1.000000000000
result:
ok found '1.0000000', expected '1.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3988kb
input:
3 1 0 1 2 1 2 2 1 2 2
output:
1.570796326795
result:
ok found '1.5707963', expected '1.5707963', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3720kb
input:
3 1 0 1 10000 1 2 2 1 2 2
output:
2500.707752257475
result:
ok found '2500.7077523', expected '2500.7077523', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
3 10000 10000 1 10000 10000 9999 10000 10000 9999 10000
output:
0.384241300290
result:
ok found '0.3842413', expected '0.3842413', error '0.0000000'
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 4020kb
input:
3 -10000 -10000 10000 10000 -10000 -9999 -10000 -10000 -9999 -10000
output:
-7497.092651881511
result:
wrong answer 1st numbers differ - expected: '2500.2406700', found: '-7497.0926519', error = '3.9985484'