QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#619070 | #5152. Circular Caramel Cookie | Rafat_Kabir | AC ✓ | 4ms | 3936kb | C++20 | 3.4kb | 2024-10-07 12:50:22 | 2024-10-07 12:50:22 |
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
const ll maxN = 1e9;
void solve(int it)
{
ll n;
cin >> n;
ll l = 0, r = 1e10;
double ans = 0;
auto ok = [&](ll radius_sq)->bool{
ll cnt = 0;
ll limit = sqrt(radius_sq);
FOR(1, limit, i){
int Y_sq = radius_sq-i*i;
if(Y_sq > 0) cnt += sqrt(Y_sq);
}
cnt *= 4;
return cnt > n;
};
while(l <= r){
ll mid = (l + r) / 2;
// cout << mid << "->";
if(ok(mid)){
ans = sqrt(mid);
r = mid - 1;
}else{
l = mid + 1;
}
}
cout << fixed << setprecision(20) << ans;
}
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: 1ms
memory: 3932kb
input:
11
output:
2.23606797749978980505
result:
ok found '2.2360680', expected '2.2360680', error '0.0000000'
Test #2:
score: 0
Accepted
time: 1ms
memory: 3816kb
input:
59
output:
5.00000000000000000000
result:
ok found '5.0000000', expected '5.0000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3812kb
input:
1
output:
1.41421356237309514547
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #4:
score: 0
Accepted
time: 1ms
memory: 3884kb
input:
2
output:
1.41421356237309514547
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3924kb
input:
3
output:
1.41421356237309514547
result:
ok found '1.4142136', expected '1.4142136', error '0.0000000'
Test #6:
score: 0
Accepted
time: 1ms
memory: 3892kb
input:
4
output:
2.23606797749978980505
result:
ok found '2.2360680', expected '2.2360680', error '0.0000000'
Test #7:
score: 0
Accepted
time: 4ms
memory: 3872kb
input:
1000000000
output:
17841.88131896409686305560
result:
ok found '17841.8813190', expected '17841.8813190', error '0.0000000'
Test #8:
score: 0
Accepted
time: 1ms
memory: 3772kb
input:
16
output:
3.16227766016837952279
result:
ok found '3.1622777', expected '3.1622777', error '0.0000000'
Test #9:
score: 0
Accepted
time: 1ms
memory: 3872kb
input:
60
output:
5.09901951359278449161
result:
ok found '5.0990195', expected '5.0990195', error '0.0000000'
Test #10:
score: 0
Accepted
time: 1ms
memory: 3712kb
input:
276
output:
10.04987562112088994581
result:
ok found '10.0498756', expected '10.0498756', error '0.0000000'
Test #11:
score: 0
Accepted
time: 1ms
memory: 3888kb
input:
476
output:
13.03840481040529830636
result:
ok found '13.0384048', expected '13.0384048', error '0.0000000'
Test #12:
score: 0
Accepted
time: 0ms
memory: 3876kb
input:
1860
output:
25.01999200639360765308
result:
ok found '25.0199920', expected '25.0199920', error '0.0000000'
Test #13:
score: 0
Accepted
time: 1ms
memory: 3764kb
input:
2837456
output:
951.00841216048138448969
result:
ok found '951.0084122', expected '951.0084122', error '0.0000000'
Test #14:
score: 0
Accepted
time: 4ms
memory: 3936kb
input:
871234652
output:
16653.64272464135865448043
result:
ok found '16653.6427246', expected '16653.6427246', error '0.0000000'
Test #15:
score: 0
Accepted
time: 3ms
memory: 3620kb
input:
345230848
output:
10483.50027424047038948629
result:
ok found '10483.5002742', expected '10483.5002742', error '0.0000000'
Test #16:
score: 0
Accepted
time: 3ms
memory: 3812kb
input:
506145784
output:
12693.59436881453257228713
result:
ok found '12693.5943688', expected '12693.5943688', error '0.0000000'
Test #17:
score: 0
Accepted
time: 3ms
memory: 3876kb
input:
253745836
output:
8987.84006310748736723326
result:
ok found '8987.8400631', expected '8987.8400631', error '0.0000000'
Test #18:
score: 0
Accepted
time: 3ms
memory: 3920kb
input:
659345872
output:
14487.74520068599304067902
result:
ok found '14487.7452007', expected '14487.7452007', error '0.0000000'
Test #19:
score: 0
Accepted
time: 2ms
memory: 3868kb
input:
193830482
output:
7855.44830038362579216482
result:
ok found '7855.4483004', expected '7855.4483004', error '0.0000000'
Test #20:
score: 0
Accepted
time: 1ms
memory: 3728kb
input:
981273
output:
559.50424484538098113262
result:
ok found '559.5042448', expected '559.5042448', error '0.0000000'
Test #21:
score: 0
Accepted
time: 2ms
memory: 3876kb
input:
8732419
output:
1667.85131231773766558035
result:
ok found '1667.8513123', expected '1667.8513123', error '0.0000000'
Test #22:
score: 0
Accepted
time: 2ms
memory: 3868kb
input:
9812379
output:
1767.94230675098674510082
result:
ok found '1767.9423068', expected '1767.9423068', error '0.0000000'
Test #23:
score: 0
Accepted
time: 2ms
memory: 3872kb
input:
98273476
output:
5593.61466316728001402225
result:
ok found '5593.6146632', expected '5593.6146632', error '0.0000000'
Test #24:
score: 0
Accepted
time: 4ms
memory: 3936kb
input:
897972343
output:
16907.24451233848958509043
result:
ok found '16907.2445123', expected '16907.2445123', error '0.0000000'
Test #25:
score: 0
Accepted
time: 2ms
memory: 3748kb
input:
28736734
output:
3025.06611497996846082970
result:
ok found '3025.0661150', expected '3025.0661150', error '0.0000000'
Test #26:
score: 0
Accepted
time: 2ms
memory: 3812kb
input:
88234239
output:
5300.23886254195167566650
result:
ok found '5300.2388625', expected '5300.2388625', error '0.0000000'
Test #27:
score: 0
Accepted
time: 4ms
memory: 3820kb
input:
928379434
output:
17191.11028991437706281431
result:
ok found '17191.1102899', expected '17191.1102899', error '0.0000000'
Test #28:
score: 0
Accepted
time: 2ms
memory: 3876kb
input:
23765822
output:
2751.07324511725801130524
result:
ok found '2751.0732451', expected '2751.0732451', error '0.0000000'
Test #29:
score: 0
Accepted
time: 0ms
memory: 3872kb
input:
3427481
output:
1045.14353081287367785990
result:
ok found '1045.1435308', expected '1045.1435308', error '0.0000000'
Test #30:
score: 0
Accepted
time: 2ms
memory: 3932kb
input:
234987432
output:
8649.26632726730167632923
result:
ok found '8649.2663273', expected '8649.2663273', error '0.0000000'
Test #31:
score: 0
Accepted
time: 0ms
memory: 3892kb
input:
3242949
output:
1016.64398881811132469011
result:
ok found '1016.6439888', expected '1016.6439888', error '0.0000000'
Test #32:
score: 0
Accepted
time: 2ms
memory: 3928kb
input:
238423423
output:
8712.26887785265716956928
result:
ok found '8712.2688779', expected '8712.2688779', error '0.0000000'
Test #33:
score: 0
Accepted
time: 2ms
memory: 3880kb
input:
23784378
output:
2752.14770679191542512854
result:
ok found '2752.1477068', expected '2752.1477068', error '0.0000000'
Test #34:
score: 0
Accepted
time: 2ms
memory: 3888kb
input:
83246355
output:
5148.27048628954617015552
result:
ok found '5148.2704863', expected '5148.2704863', error '0.0000000'