QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#636843 | #9462. Safest Buildings | ucup-team5141# | TL | 0ms | 0kb | C++20 | 1.4kb | 2024-10-13 03:22:21 | 2024-10-13 03:22:21 |
answer
#include <bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define pii pair<int,int>
using ll = long long;
using lf = long double;
const lf EPS = 1e-8L;
const lf PI = acos(-1);
lf area(lf r1, lf r2, lf d) {
if (d >= r1 + r2) return 0.0L;
if (d <= fabsl(r2 - r1)) return PI * (r1 < r2 ? r1*r1 : r2*r2);
lf alpha= acos((r1*r1 - r2*r2 + d*d) / (2.0L * d * r1));
lf betha = acos((r2*r2 - r1*r1 + d*d) / (2.0L * d * r2));
lf a1 = r1*r1 * (alpha - sinl(alpha) * cosl(alpha));
lf a2 = r2*r2 * (betha - sinl(betha) * cosl(betha));
return a1 + a2;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
freopen("in", "r", stdin);
int tt; cin >> tt;
while (tt--) {
int n, R, r; cin >> n >> R >> r;
vector<pair<int, int>> a(n);
vector<lf> p(n);
for (int i = 0; i<n; ++i) {
cin >> a[i].first >> a[i].second;
p[i] = area(R - r, r, sqrt(a[i].ff*a[i].ff + a[i].ss*a[i].ss));
}
lf best = *max_element(p.begin(), p.end());
vector<int> ans;
for (int i=0; i<n; ++i) {
if (p[i] == best) ans.push_back(i);
}
cout << ans.size() << endl;
for(int i = 0; i < (int)ans.size(); ++i) {
if (i>0) cout<< ' ';
cout << ans[i] + 1;
}
cout << '\n';
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Time Limit Exceeded
input:
2 3 10 5 3 4 3 5 3 6 3 10 4 -7 -6 4 5 5 4
output:
32631 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 10...