Submission #58453700
Source Code Expand
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <list>
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <random>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define repE(i, l, r) for (ll i = (l); i <= (r); ++i)
#define rrepE(i, l, r) for (ll i = (l); i >= (r); --i)
#define Sort(v) sort(v.begin(), v.end())
#define rSort(v) sort(v.rbegin(), v.rend())
#define Uniq(v) Sort(v), v.erase(unique(v.begin(), v.end()), v.end())
#define Reverse(v) reverse(v.begin(), v.end())
#define All(a) (a).begin(),(a).end()
#define Lower_bound(v, y) \
distance(v.begin(), lower_bound(v.begin(), v.end(), y))
#define Upper_bound(v, y) \
distance(v.begin(), upper_bound(v.begin(), v.end(), y))
#define __bpcll __builtin_popcountll
#define sz(x) (ll)x.size()
#ifdef LOCAL
#include <debug_print.hpp>
#define debug(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (static_cast<void>(0))
#endif
using ll = long long;
using l3 = __int128_t;
using ull = unsigned long long;
using ld = long double;
using P = pair<ll, ll>;
using T = tuple<ll, ll, ll>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vvvll = vector<vvll>;
using vvvvll = vector<vvvll>;
using vP = vector<P>;
using vvP = vector<vector<P>>;
using vT = vector<T>;
using vvT = vector<vT>;
using vD = vector<ld>;
using vvD = vector<vD>;
using vvvD = vector<vvD>;
using dqll = deque<ll>;
ll dx[9] = {-1, 1, 0, 0, -1, -1, 1, 1, 0};
ll dy[9] = {0, 0, -1, 1, -1, 1, -1, 1, 0};
template <class T>
inline bool chmax(T &a, T b)
{
if (a < b)
{
a = b;
return 1;
}
return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
if (a > b)
{
a = b;
return 1;
}
return 0;
}
constexpr ll INF = (1LL << 60);
//constexpr ld eps = 1E-10;
constexpr ll mod = 1000000007;
//constexpr ll mod = 998244353;
//ll mod;
ll xadd(ll a, ll b) { return a+b; }
ll xmax(ll a, ll b) { return max(a, b); }
ll xmin(ll a, ll b) { return min(a, b); }
ll xinf() { return INF; }
ll xminf() { return -INF; }
ll xzero() { return 0LL; }
struct mint
{
ll x; // typedef long long ll;
mint(ll x = 0) : x((x % mod + mod) % mod) {}
mint operator-() const { return mint(-x); }
mint &operator+=(const mint a)
{
if ((x += a.x) >= mod)
x -= mod;
return *this;
}
mint &operator-=(const mint a)
{
if ((x += mod - a.x) >= mod)
x -= mod;
return *this;
}
mint &operator*=(const mint a)
{
(x *= a.x) %= mod;
return *this;
}
mint operator+(const mint a) const { return mint(*this) += a; }
mint operator-(const mint a) const { return mint(*this) -= a; }
mint operator*(const mint a) const { return mint(*this) *= a; }
mint pow(ll t) const
{
if (!t)
return 1;
mint a = pow(t >> 1);
a *= a;
if (t & 1)
a *= *this;
return a;
}
// for prime mod
mint inv() const { return pow(mod - 2); }
mint &operator/=(const mint a) { return *this *= a.inv(); }
mint operator/(const mint a) const { return mint(*this) /= a; }
};
istream &operator>>(istream &is, mint &a) { return is >> a.x; }
ostream &operator<<(ostream &os, const mint &a) { return os << a.x; }
class modutils
{
vector<mint> fact, invfact;
public:
modutils(int n = 200005) : fact(n + 1), invfact(n + 1)
{
fact[0] = 1;
for (int i = 1; i <= n; i++)
fact[i] = fact[i - 1] * i;
invfact[n] = fact[n].inv();
for (int i = n; i >= 1; i--)
invfact[i - 1] = invfact[i] * i;
}
mint pow(mint x, ll n) { return x.pow(n); }
mint comb(ll n, ll k)
{
if (n < 0 || k < 0 || n < k)
return 0;
return fact[n] * invfact[k] * invfact[n - k];
}
mint perm(ll n, ll k)
{
if (n < 0 || k < 0 || n < k)
return 0;
return fact[n] * invfact[n - k];
}
mint hom(ll n, ll k) { return comb(n + k - 1, k); }
mint fac(ll n) { return fact[n]; }
mint invfac(ll n) { return invfact[n]; }
};
using vm = vector<mint>;
using vvm = vector<vm>;
using vvvm = vector<vvm>;
template<class T> T cdv(const T &a, const T &b){
if(a%b==0){return a/b;}
if(a>=0){return (a/b)+1;}
else{return -((-a)/b);}
}
template<class T> T fdv(const T &a, const T &b){
if(a%b==0){return a/b;}
if(a>=0){return (a/b);}
else{return -((-a)/b)-1;}
}
ld ld_dist(ld x, ld y, ld a, ld b){
return sqrt((x-a)*(x-a)+(y-b)*(y-b));
}
ll mymod(ll a, ll b) { return (a%b+b)%b; }
int main(){
cout << fixed << setprecision(15);
ll n, s, t;
cin >> n >> s >> t;
vll as(n), bs(n), cs(n), ds(n);
rep(i, n) cin >> as[i] >> bs[i] >> cs[i] >> ds[i];
vll ps(n);
rep(i, n) ps[i] = i;
ld ans = 9e18;
do {
rep(st, 1LL<<n){
ll x = 0, y = 0;
ld cur = 0;
rep(j, n){
ll i = ps[j];
ll ax, ay, bx, by;
if(st>>j&1){
ax = as[i];
ay = bs[i];
bx = cs[i];
by = ds[i];
} else {
ax = cs[i];
ay = ds[i];
bx = as[i];
by = bs[i];
}
ld t1 = ld_dist(x, y, ax, ay);
ld t2 = ld_dist(ax, ay, bx, by);
cur += t1/s+t2/t;
x = bx;
y = by;
}
if(chmin(ans, cur)){
//debug(ps, s);
}
}
} while(next_permutation(All(ps)));
cout << ans << endl;
return 0;
}
Submission Info
| Submission Time |
|
| Task |
D - Laser Marking |
| User |
kiyu |
| Language |
C++ 20 (gcc 12.2) |
| Score |
350 |
| Code Size |
5850 Byte |
| Status |
AC |
| Exec Time |
3 ms |
| Memory |
3884 KiB |
Judge Result
| Set Name |
Sample |
All |
| Score / Max Score |
0 / 0 |
350 / 350 |
| Status |
|
|
| Set Name |
Test Cases |
| Sample |
sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt |
| All |
sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt, test_31.txt, test_32.txt, test_33.txt, test_34.txt, test_35.txt, test_36.txt, test_37.txt, test_38.txt, test_39.txt, test_40.txt, test_41.txt, test_42.txt, test_43.txt, test_44.txt, test_45.txt, test_46.txt, test_47.txt, test_48.txt, test_49.txt, test_50.txt, test_51.txt, test_52.txt, test_53.txt, test_54.txt, test_55.txt, test_56.txt, test_57.txt, test_58.txt, test_59.txt, test_60.txt, test_61.txt, test_62.txt, test_63.txt, test_64.txt, test_65.txt, test_66.txt, test_67.txt, test_68.txt, test_69.txt, test_70.txt |
| Case Name |
Status |
Exec Time |
Memory |
| sample_01.txt |
AC |
1 ms |
3884 KiB |
| sample_02.txt |
AC |
1 ms |
3872 KiB |
| sample_03.txt |
AC |
3 ms |
3808 KiB |
| sample_04.txt |
AC |
3 ms |
3756 KiB |
| test_01.txt |
AC |
1 ms |
3784 KiB |
| test_02.txt |
AC |
1 ms |
3784 KiB |
| test_03.txt |
AC |
1 ms |
3752 KiB |
| test_04.txt |
AC |
1 ms |
3764 KiB |
| test_05.txt |
AC |
3 ms |
3804 KiB |
| test_06.txt |
AC |
1 ms |
3868 KiB |
| test_07.txt |
AC |
1 ms |
3704 KiB |
| test_08.txt |
AC |
1 ms |
3856 KiB |
| test_09.txt |
AC |
1 ms |
3764 KiB |
| test_10.txt |
AC |
1 ms |
3800 KiB |
| test_11.txt |
AC |
3 ms |
3704 KiB |
| test_12.txt |
AC |
1 ms |
3872 KiB |
| test_13.txt |
AC |
1 ms |
3808 KiB |
| test_14.txt |
AC |
1 ms |
3804 KiB |
| test_15.txt |
AC |
1 ms |
3696 KiB |
| test_16.txt |
AC |
1 ms |
3884 KiB |
| test_17.txt |
AC |
3 ms |
3820 KiB |
| test_18.txt |
AC |
1 ms |
3812 KiB |
| test_19.txt |
AC |
1 ms |
3784 KiB |
| test_20.txt |
AC |
1 ms |
3872 KiB |
| test_21.txt |
AC |
1 ms |
3700 KiB |
| test_22.txt |
AC |
1 ms |
3772 KiB |
| test_23.txt |
AC |
3 ms |
3764 KiB |
| test_24.txt |
AC |
1 ms |
3800 KiB |
| test_25.txt |
AC |
1 ms |
3696 KiB |
| test_26.txt |
AC |
1 ms |
3864 KiB |
| test_27.txt |
AC |
1 ms |
3744 KiB |
| test_28.txt |
AC |
1 ms |
3776 KiB |
| test_29.txt |
AC |
3 ms |
3864 KiB |
| test_30.txt |
AC |
1 ms |
3704 KiB |
| test_31.txt |
AC |
1 ms |
3756 KiB |
| test_32.txt |
AC |
1 ms |
3808 KiB |
| test_33.txt |
AC |
1 ms |
3756 KiB |
| test_34.txt |
AC |
1 ms |
3764 KiB |
| test_35.txt |
AC |
3 ms |
3760 KiB |
| test_36.txt |
AC |
1 ms |
3764 KiB |
| test_37.txt |
AC |
1 ms |
3696 KiB |
| test_38.txt |
AC |
1 ms |
3764 KiB |
| test_39.txt |
AC |
1 ms |
3800 KiB |
| test_40.txt |
AC |
1 ms |
3812 KiB |
| test_41.txt |
AC |
3 ms |
3816 KiB |
| test_42.txt |
AC |
1 ms |
3760 KiB |
| test_43.txt |
AC |
1 ms |
3696 KiB |
| test_44.txt |
AC |
1 ms |
3816 KiB |
| test_45.txt |
AC |
1 ms |
3788 KiB |
| test_46.txt |
AC |
1 ms |
3868 KiB |
| test_47.txt |
AC |
3 ms |
3864 KiB |
| test_48.txt |
AC |
1 ms |
3700 KiB |
| test_49.txt |
AC |
1 ms |
3704 KiB |
| test_50.txt |
AC |
1 ms |
3764 KiB |
| test_51.txt |
AC |
1 ms |
3872 KiB |
| test_52.txt |
AC |
1 ms |
3764 KiB |
| test_53.txt |
AC |
3 ms |
3708 KiB |
| test_54.txt |
AC |
1 ms |
3864 KiB |
| test_55.txt |
AC |
1 ms |
3780 KiB |
| test_56.txt |
AC |
1 ms |
3760 KiB |
| test_57.txt |
AC |
1 ms |
3688 KiB |
| test_58.txt |
AC |
1 ms |
3764 KiB |
| test_59.txt |
AC |
3 ms |
3876 KiB |
| test_60.txt |
AC |
1 ms |
3808 KiB |
| test_61.txt |
AC |
3 ms |
3716 KiB |
| test_62.txt |
AC |
3 ms |
3820 KiB |
| test_63.txt |
AC |
1 ms |
3800 KiB |
| test_64.txt |
AC |
1 ms |
3880 KiB |
| test_65.txt |
AC |
3 ms |
3764 KiB |
| test_66.txt |
AC |
3 ms |
3692 KiB |
| test_67.txt |
AC |
3 ms |
3696 KiB |
| test_68.txt |
AC |
3 ms |
3880 KiB |
| test_69.txt |
AC |
3 ms |
3764 KiB |
| test_70.txt |
AC |
3 ms |
3880 KiB |