QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#549803 | #854. Archer Vlad | Rafat_Kabir | AC ✓ | 71ms | 3948kb | C++20 | 3.2kb | 2024-09-06 21:34:46 | 2024-09-06 21:34:47 |
Judging History
answer
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <time.h>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <cstring>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <iostream>
using namespace __gnu_pbds;
using namespace std;
template <class T>
using Tree =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// to erase in multiset-> less_equal<T> and
// s.erase(s.find_by_order(s.order_of_key(x)))
// lower_bound(x)=>(cannot use the stl lower_bound function)
// ll idx = s.order_of_key(x)
// if(idx == s.size()) -> no lower_bound
// else lb = *s.find_by_order(idx) // as 0-indexing
// idx-1 will give highest value which is strictly less than x
// for upper_bound->do the same with (x+1)
typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef tuple<ll, ll, ll> t64;
typedef vector<t64> vt64;
typedef vector<vt64> vvt64;
typedef pair<double,double> pdd;
typedef vector<ll> v64;
typedef vector<int> v32;
typedef vector<vector<int> > vv32;
typedef vector<vector<ll> > vv64;
typedef vector<vector<p64> > vvp64;
typedef vector<p64> vp64;
typedef vector<p32> vp32;
typedef vector<vector<p32> > vvp32;
typedef vector<bool> vb;
ll mod = 1e9+7, MOD = 998244353;
double eps = 1e-12;
// #define forn(i,e) for(ll i = 0; i < e; i++)
#define FOR(s, e, i) for(int i = s; i <= e; i++)
// #define rforn(i,s) for(ll i = s; i >= 0; i--)
#define ROF(s ,e, i) for(int i = s; i >= e; i--)
#define coutAll(A) for(auto asdafas : A) cout << asdafas << " "; cout << "\n";
#define foutAll(A) for(auto asdafas : A) fout << asdafas << " "; cout << "\n";
#define cinAll(A) for(auto &asdafas : A) cin >> asdafas;
#define finAll(A) for(auto &asdafas : A) fin >> asdafas;
#define minpq priority_queue<ll, v64, greater<ll>>
#define maxpq priority_queue<ll>
#define ln "\n"
#define dbg(x) cout<<#x<<" = "<<x<<ln
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define fi first
#define se second
ll inf = LLONG_MAX;
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) ((ll)(x).size())
#define yes cout<<"YES\n"
#define no cout<<"NO\n"
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vector<ll>> vvll;
typedef pair<ll, ll> pll;
typedef pair<ll, ll> pii;
//#define MAXN 1000000
void solve(int it)
{
ld v;
ll n;
cin >> v >> n;
ld ans = 0;
ld l = 0, r = 1e18;
FOR(0, n -1, i){
ld x, y; cin >> x >> y;
ld z = sqrt(v*v*v*v-2*v*v*10*y-10*10*x*x);
ld res1 = v*v+z;
res1 /= 10*x;
ld res2 = v*v-z;
res2 /= 10*x;
l = max(l, res2);
r = min(r, res1);
}
cout << fixed << setprecision(3) << (l+r)/2 << "\n";
}
int main()
{
fast_cin();
ll t = 1;
cin >> t;
for(int it=1; it<=t; it++)
{
//cout << "Case " << it << ": ";
solve(it);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3884kb
input:
3 5 1 1 1 5 1 1 1 13 1 7 7
output:
2.500 2.500 2.414
result:
ok OK!
Test #2:
score: 0
Accepted
time: 71ms
memory: 3948kb
input:
15000 793 16 5023 26074 2250 212 5095 26384 7864 30618 2655 18285 8220 30295 8967 14062 1385 10550 2123 483 5949 29841 1133 4219 2799 9397 14596 297 9182 26752 7963 19230 9743 27315 823 20 1236 29918 2106 33247 2170 32933 233 7895 3534 6371 3689 1660 406 2521 2844 24587 3493 8197 1027 25571 3508 598...
output:
8.442 36.185 20.572 273.910 18.696 29.060 110.278 12.082 14.515 13.183 19.789 215.756 83.673 10.710 113.555 15.339 97.488 5.116 101.252 99.085 15.614 152.796 444.002 60.898 44.910 25.631 823.818 34.669 6.492 317.574 29.716 195.074 37.203 13.910 21.407 1543.894 281.493 33.724 3.837 11.687 47.155 15.6...
result:
ok OK!
Test #3:
score: 0
Accepted
time: 70ms
memory: 3940kb
input:
3 19112 96700 61 1139 1404681 996391 611808 8078391 300933 11496043 153415 6845133 1042621 1458903 543181 10794457 540016 8901506 605856 17717943 601862 17736824 550847 13224828 589935 4906022 1004257 15398146 196961 8477541 1240948 7039907 323244 12250962 1073473 13597516 780105 9198741 1323591 570...
output:
50.443 24.470 135.487
result:
ok OK!
Test #4:
score: 0
Accepted
time: 70ms
memory: 3840kb
input:
300 2226986 999 433999235 186709993 848826471 261170474 799455940 83848717 993614583 969953940 898743613 36130940 748035930 519926360 721067416 477366656 719083956 425975922 28336416 604459608 52425916 861079714 571083926 496364771 155240245 648550377 215332457 745715814 761358368 780244098 95625137...
output:
813.916 636.209 3041.703 2773.208 500.477 1071.019 1062.261 1148.308 558.132 586.469 204.772 951.174 3308.495 1137.213 504.847 369.550 5507.769 267.721 3222.394 182.591 4955.533 1061.095 1806.549 339.700 673.189 2300.869 578.931 275.501 592.149 3319.903 1326.553 296.076 1615.773 737.142 940.851 323....
result:
ok OK!