Submission #4353365


Source Code Expand

Copy
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << (x) << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
template<class S,class T> ostream& operator<<(ostream& o,const pair<S,T> &p){
	return o<<"("<<p.fs<<","<<p.sc<<")";
}
template<class T> ostream& operator<<(ostream& o,const vector<T> &vc){
	o<<"{";
	for(const T& v:vc) o<<v<<",";
	o<<"}";
	return o;
}
using ll = long long;
template<class T> using V = vector<T>;
template<class T> using VV = vector<vector<T>>;

double solve(double X, double x){
	double res = 0;
	if(x+x>X){
		res += (x+x-X);
		res += 2.0 * (X-x)/3.0;
	}else{
		res += (X-x-x) * (x/(X-x))*(x/(X-x));
		res += 2.0 * (x*x*x/3/(X-x)/(X-x));
	}
	return res;
}

int main(){
//  std::random_device seed_gen;
//   std::default_random_engine engine(seed_gen());	
//   auto test = [&](double X,double x){
// 		double sum = 0;
// 		int N = 100000;
// 		uniform_real_distribution<> dist(0,X-x);
// 		rep(_,N){
// 			double a = dist(engine);
// 			double b = dist(engine);
// 			sum += max(0.0,x-abs(a-b));
// 		}
// 		show(sum/N);
// 	};
// 	while(true){
// 		double X,x;
// 		cin>>X>>x;
// 		test(X,x);
// 	}
	double H,W,A,B;
	cin>>H>>W>>A>>B;
	
	printf("%.12f\n",solve(H,A)*solve(W,B));
}

Submission Info

Submission Time
Task A - Affiches
User sigma425
Language C++14 (GCC 5.4.1)
Score 500
Code Size 1494 Byte
Status
Exec Time 1 ms
Memory 256 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 01.txt, 02.txt
All 500 / 500 01.txt, 02.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt
Case Name Status Exec Time Memory
01.txt 1 ms 256 KB
02.txt 1 ms 256 KB
10.txt 1 ms 256 KB
11.txt 1 ms 256 KB
12.txt 1 ms 256 KB
13.txt 1 ms 256 KB
14.txt 1 ms 256 KB
15.txt 1 ms 256 KB
16.txt 1 ms 256 KB
17.txt 1 ms 256 KB
18.txt 1 ms 256 KB
19.txt 1 ms 256 KB