Submission #8178663


Source Code Expand

Copy
#include<bits/extc++.h>
#include<bits/stdc++.h>
#pragma GCC optimize("unroll-loops,no-stack-protector,O3")
using namespace std;using ll = long long;using ull = unsigned long long;using ul = unsigned;using db = double;using __gnu_pbds::null_type;
#ifdef _debug 
#define dout(i) cout << #i << ' ' << i << ' '
#else 
#define dout(i) 0&&0
#endif
#define eout(i) {cout << (i) << '\n';exit(0);}
#define priority_queue __gnu_pbds::priority_queue
#define unordered_map __gnu_pbds::gp_hash_table
#define rep(a, b) {for(int i = a;i > 0;--i){b;}}
#define multe int _T;for(cin >> _T;_T--;)
pair<long long, long long> ext_gcd(long long a, long long b){if(a % b == 0)return {0ll, 1ll};auto get = ext_gcd(b, a % b);return {get.second, get.first - a / b * get.second};} long long ext_inv(long long a, long long p){return (ext_gcd(a, p).first + p) % p;} vector<int> kfunc(const string &w){vector<int> k(w.size());for(int q = 0, i = 1;i < w.size();++i){for(;q > 0 and w[i] != w[q];q = k[q-1]);k[i] = (q += w[i] == w[q]);}return k;} vector<int> zfunc(const string &w){vector<int> z(w.size());for(int l = 0, i = 1;i < w.size();++i){z[i] = max(0, min(l+z[l] - i, z[i-l]));for(;i+z[i] < w.size() and w[i+z[i]] == w[z[i]];++z[i])l = i;}return z;} template<typename T> using rbtree = __gnu_pbds::tree<T,__gnu_pbds::null_type,less<T>,__gnu_pbds::rb_tree_tag,__gnu_pbds::tree_order_statistics_node_update>; template<typename T> inline long long pow(long long v, long long t, const T &p){long long res = 1;for(;t;t >>= 1, v = v * v % p)if(t & 1)res = res * v % p;return res;} template<typename T> inline void floyd_warshall(vector<vector<T>> &dp){for(int i = 0;i < dp.size();++i)for(int j = 0;j < dp.size();++j)for(int k = 0;k < dp.size();++k)dp[i][k] = min(dp[i][k], dp[i][j] + dp[j][k]);} template<typename T> inline ostream& operator << (ostream &ou, const vector<T> &a){for(auto it = a.begin();it != a.end();++it)ou << (it != a.begin() ? " " : "") << *it;return ou;} template<typename T> inline vector<vector<T>> operator * (const vector<vector<T>> &a, const vector<vector<T>> &b){assert(a.front().size() == b.size());vector<vector<T>> res(a.size(), vector<T>(b.front().size()));for(int i = 0;i < a.size();++i)for(int j = 0;j < b.front().size();++j)for(int k = 0;k < a.front().size();++k)res[i][j] += a[i][k] * b[k][j];return res;} template<typename T> inline vector<vector<T>> pow(vector<vector<T>> v, long long t){vector<vector<T>> res;for(;t;t >>= 1, v = v * v)if(t & 1)res = (res.empty() ? v : res * v);return res;} template<typename T> void read(int n, T *s){while(n--)cin >> *s, ++s;} template<typename T> void read(int n, vector<T> &v){for(int i = 0;i < n;++i)cin >> v[i];} template<typename T> void write(int n, T *s){while(n--)cout << *s << " \n"[n==0], ++s;} template<typename T1, typename T2>inline istream& operator >> (istream &in, pair<T1, T2> &a){return in >> a.first >> a.second;} template<typename T1, typename T2>inline ostream& operator << (ostream &ou, const pair<T1, T2> &b){return ou << b.first << ' ' << b.second;} template<typename T1, typename T2>inline pair<T1,T2> operator + (const pair<T1,T2> &a, const pair<T1,T2> &b){return {a.first + b.first, a.second + b.second};} template<typename T1, typename T2>inline pair<T1,T2> operator - (const pair<T1,T2> &a, const pair<T1,T2> &b){return {a.first - b.first, a.second - b.second};} template<typename T1, typename T2>inline long long operator ^ (const pair<T1,T2> &a, const pair<T1,T2> &b){return (long long)a.first * b.second - (long long)a.second * b.first;} 
db a, b, x;
const db pi = 3.1415926535897932384626433;
bool ok(db ang){
	if(a * tan(ang * pi / 100) > b){
		return tan((90-ang) * pi / 180) * b * b * a / 2 < x;
	}
	return a * a * b - a * a * (a * tan(ang * pi / 180)) / 2 < x;
}
signed main(){
	ios_base::sync_with_stdio(0), cin.tie(0);
	cin >> a >> b >> x;
	db l = 0, r = 90;
	int t = 1000000;
	while(t--){
		db mid = (l+r)/2;
		if(ok(mid))r = mid;
		else l = mid;
	}
	printf("%.20f\n", (l+r)/2);
}

Submission Info

Submission Time
Task D - Water Bottle
User Kevin_Zhang_TW
Language C++14 (GCC 5.4.1)
Score 0
Code Size 3995 Byte
Status
Exec Time 184 ms
Memory 384 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample00, sample01, sample02
All 0 / 400 handmade03, handmade04, random05, random06, random07, random08, random09, random10, random11, random12, random13, random14, sample00, sample01, sample02
Case Name Status Exec Time Memory
handmade03 18 ms 256 KB
handmade04 73 ms 384 KB
random05 67 ms 256 KB
random06 67 ms 256 KB
random07 56 ms 256 KB
random08 82 ms 256 KB
random09 68 ms 256 KB
random10 184 ms 256 KB
random11 65 ms 256 KB
random12 50 ms 256 KB
random13 38 ms 256 KB
random14 34 ms 256 KB
sample00 65 ms 256 KB
sample01 64 ms 256 KB
sample02 46 ms 256 KB