QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#383257#5537. Storing Eggskevinyang#AC ✓204ms117872kbC++2010.9kb2024-04-09 07:53:442024-04-09 07:53:46

Judging History

This is the latest submission verdict.

  • [2024-04-09 07:53:46]
  • Judged
  • Verdict: AC
  • Time: 204ms
  • Memory: 117872kb
  • [2024-04-09 07:53:44]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")

/* Macros {{{ */
/*  A lot of this is from some of Benq's submissions
    [https://codeforces.com/profile/Benq]
    Ugly af to the eyes, but with vim fold its barable
    Hopefully c++20 concepts can make all this stuff must cleaner */

/* Basics {{{ */
using ll = long long;
using ld = long double;
using str = string;

using pi = pair<int, int>;
using pll = pair<ll, ll>;
using pld = pair<ld, ld>;
#define mp make_pair
#define fi first
#define se second

#define arr array
#define ve vector
using vi = vector<int>;
using vll = vector<ll>;
using vld = vector<ld>;

using vpi = vector<pi>;
using vpll = vector<pll>;
using vpld = vector<pld>;

using vvi = vector<vi>;
using vvll = vector<vll>;
using vvld = vector<vld>;

using vvpi = vector<vpi>;
using vvpll = vector<vpll>;
using vvpld = vector<vpld>;

#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define sz size()
#define rsz(a) resize(a)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()

#define For(i, a, b) for (int i = a; i < b; ++i)
#define Rof(i, a, b) for (int i = (b)-1; i >= (a); --i)
#define rep(a) For(_, 0, a)
#define each(a, x) for (auto &a : x)
#define reach(a, x) for (auto a = x.rbegin(); a != x.rend(); ++a)

template <typename T, typename U>
inline void cmin(T &x, U y) {
    if (y < x) x = y;
}
template <typename T, typename U>
inline void cmax(T &x, U y) {
    if (x < y) x = y;
}
/*}}}*/

/* IO {{{ */

/* Template Macros {{{ */
#define tcT template <class T
#define tcTU tcT, class U
#define tcTUU tcT, class... U
/*}}}*/

inline namespace Helpers { /*{{{*/
tcT, class = void > struct is_iterable : false_type {};
tcT > struct is_iterable<
          T, void_t<decltype(begin(declval<T>())), decltype(end(declval<T>()))>>
    : true_type {};
tcT > constexpr bool is_iterable_v = is_iterable<T>::value;

tcT, class = void > struct is_readable : false_type {};
tcT > struct is_readable<T, typename std::enable_if_t<is_same_v<
                                decltype(cin >> declval<T &>()), istream &>>>
    : true_type {};
tcT > constexpr bool is_readable_v = is_readable<T>::value;

tcT, class = void > struct is_printable : false_type {};
tcT > struct is_printable<T, typename std::enable_if_t<is_same_v<
                                 decltype(cout << declval<T>()), ostream &>>>
    : true_type {};
tcT > constexpr bool is_printable_v = is_printable<T>::value;
} /* namespace Helpers */
/*}}}*/

inline namespace Input { /*{{{*/
tcT > constexpr bool needs_input_v = !is_readable_v<T> && is_iterable_v<T>;
tcTUU > void re(T &t, U &...u);
tcTU > void re(pair<T, U> &p); /* pairs */

/* re: read{{{ */
tcT > typename enable_if<is_readable_v<T>, void>::type re(T &x) {
    cin >> x;
} /* default */
tcT > typename enable_if<needs_input_v<T>, void>::type re(
          T &i);                                   // vectors, arrays, etc...
tcTU > void re(pair<T, U> &p) { re(p.fi, p.se); }  // pairs
tcT > typename enable_if<needs_input_v<T>, void>::type re(T &i) {
    each(x, i) re(x);
}
tcTUU > void re(T &t, U &...u) {
    re(t);
    re(u...);
} /* read multiple}}} */

/* rv: resize and read vectors{{{ */
void rv(size_t) {}
tcTUU > void rv(size_t N, ve<T> &t, U &...u);
template <class... U>
void rv(size_t, size_t N2, U &...u);
tcTUU > void rv(size_t N, ve<T> &t, U &...u) {
    t.rsz(N);
    re(t);
    rv(N, u...);
}
template <class... U>
void rv(size_t, size_t N2, U &...u) {
    rv(N2, u...);
} /*}}}*/

/* dumb shortcuts to read in ints{{{ */
void decrement() {} /* subtract one from each */
tcTUU > void decrement(T &t, U &...u) {
    --t;
    decrement(u...);
}
#define ints(...)    \
    int __VA_ARGS__; \
    re(__VA_ARGS__);
#define int1(...)      \
    ints(__VA_ARGS__); \
    decrement(__VA_ARGS__); /*}}}*/
} /* namespace Input */
/*}}}*/

inline namespace ToString { /*{{{*/
tcT > constexpr bool needs_output_v = !is_printable_v<T> && is_iterable_v<T>;

/* ts: string representation to print */
tcT > typename enable_if<is_printable_v<T>, str>::type ts(T v) {
    stringstream ss;
    ss << fixed << setprecision(15) << v;
    return ss.str();
} /* default */
tcT > str bit_vec(T t) { /* bit vector to string */
    str res = "{";
    For(i, 0, t.sz) res += ts(t[i]);
    res += "}";
    return res;
}
str ts(ve<bool> v) { return bit_vec(v); }
template <size_t SZ>
str ts(bitset<SZ> b) {
    return bit_vec(b);
} /* bit vector */
tcTU > str ts(pair<T, U> p); /* pairs */
tcT > typename enable_if<needs_output_v<T>, str>::type ts(
          T v); /* vectors, arrays */
tcTU > str ts(pair<T, U> p) { return "(" + ts(p.fi) + ", " + ts(p.se) + ")"; }
tcT > typename enable_if<is_iterable_v<T>, str>::type ts_sep(T v, str sep) {
    /* convert container to string w/ separator sep */
    bool fst = 1;
    str res = "";
    for (const auto &x : v) {
        if (!fst) res += sep;
        fst = 0;
        res += ts(x);
    }
    return res;
}
tcT > typename enable_if<needs_output_v<T>, str>::type ts(T v) {
    return "{" + ts_sep(v, ", ") + "}";
}

/* for nested DS */
template <int, class T>
typename enable_if<!needs_output_v<T>, ve<str>>::type ts_lev(const T &v) {
    return {ts(v)};
}
template <int lev, class T>
typename enable_if<needs_output_v<T>, ve<str>>::type ts_lev(const T &v) {
    if (lev == 0 || !v.sz) return {ts(v)};
    ve<str> res;
    for (const auto &t : v) {
        if (res.sz) res.back() += ",";
        ve<str> tmp = ts_lev<lev - 1>(t);
        res.insert(end(res), all(tmp));
    }
    For(i, 0, res.sz) {
        str bef = " ";
        if (i == 0) bef = "{";
        res[i] = bef + res[i];
    }
    res.back() += "}";
    return res;
}
} /* namespace ToString */
/*}}}*/

inline namespace Output { /*{{{*/
template <class T>
void pr_sep(ostream &os, str, const T &t) {
    os << ts(t);
}
template <class T, class... U>
void pr_sep(ostream &os, str sep, const T &t, const U &...u) {
    pr_sep(os, sep, t);
    os << sep;
    pr_sep(os, sep, u...);
}
/* print w/ no spaces */
template <class... T>
void pr(const T &...t) {
    pr_sep(cout, "", t...);
}
/* print w/ spaces, end with newline */
void ps() { cout << "\n"; }
template <class... T>
void ps(const T &...t) {
    pr_sep(cout, " ", t...);
    ps();
}
/* debug to cerr */
template <class... T>
void dbg_out(const T &...t) {
    pr_sep(cerr, " | ", t...);
    cerr << endl;
}
void loc_info(int line, str names) {
    cerr << "Line(" << line << ") -> [" << names << "]: ";
}
template <int lev, class T>
void dbgl_out(const T &t) {
    cerr << "\n\n" << ts_sep(ts_lev<lev>(t), "\n") << "\n" << endl;
}
} /* namespace Output */
/*}}}}}}}}}*/


int n, k;
ve<str> carton;

int dp[101][301][101][64] = { };

int precmp[101][101][64][8] = {  };

void init_precmp() {
    for (int s = 0; s < 64; ++s) {/*{{{*/
        int s0 = s>>4, s1 = (s&15)>>2, s2 = s&3;

        for (int cols = 0; cols < 8; ++cols) {
            int c0 = cols>>2, c1 = (cols&2)>>1, c2 = cols&1;

            for (int x = 0; x <= n; ++x) {
                for (int i = 0; i <= n; ++i) {

                    int opt = INT_MAX/4;

                                if(c1 & (c0 | c2)) cmin(opt, 1);

                                if(c0 & c2) cmin(opt, 4);

                                if(s0 != 0) {
                                    int dx = (i - (x-1+(s0&1)));
                                    int dx2 =  dx*dx;

                                    if(c0) cmin(opt, dx2);
                                    else if(c1) cmin(opt, dx2 + 1);
                                    else if(c2) cmin(opt, dx2 + 4);
                                }

                                if(s1 != 0) {
                                    int dx = (i - (x-1+(s1&1)));
                                    int dx2 =  dx*dx;

                                    if(c1) cmin(opt, dx2);
                                    else if(c0|c2) cmin(opt, dx2+1);
                                }

                                if(s2 != 0) {
                                    int dx = (i - (x-1+(s2&1)));
                                    int dx2 =  dx*dx;

                                    if(c2) cmin(opt, dx2);
                                    else if(c1) cmin(opt, dx2 + 1);
                                    else if(c0) cmin(opt, dx2 + 4);
                                }

                    precmp[i][x][s][(c0<<2) | (c1<<1) | c2] = opt;
                }
            }
        }
    }/*}}}*/
}

inline int transition(int i, int k, int x, int s0, int s1, int s2) {
    if(k <= 0) return INT_MAX/4;
    if(i >= n) return -1;


    int s = (s0<<4) | (s1<<2) | s2;


    if(dp[i][k][x][s] != 0) return dp[i][k][x][s];
    int &res = dp[i][k][x][s];

    res = max(1, transition(i+1, k, x, s0, s1, s2));

    int csm = (carton[0][i] << 2) | (carton[1][i] << 1) | carton[2][i];
    for(int cols=csm; cols>0; cols=(cols-1)&csm) {

        int opt = precmp[i][x][s][cols];
        if(opt <= res) continue;

        int c0 = (cols&4)>>2, c1 = (cols&2)>>1, c2 = cols&1;
        if(((k-c0-c1-c2) < 0)) continue;

        if(x == i-1) cmin(opt, transition(i+1, k-c0-c1-c2, i, ((s0<<1)|c0)&3, ((s1<<1)|c1)&3, ((s2<<1)|c2)&3));
        else cmin(opt, transition(i+1, k-c0-c1-c2, i, c0, c1, c2));

        cmax(res, opt);
    }

    // for(int c0=0; c0<=carton[0][i]; ++c0) {
    //     for(int c1=0; c1<=carton[1][i]; ++c1) {
    //         for(int c2=0; c2<=carton[2][i]; ++c2) {
    //             if(c0 == 0 && c1 == 0 && c2 == 0) continue;
    //
    //             int opt = precmp[i][x][s][(c0<<2) | (c1<<1) | c2 ];
    //             if(opt < res) continue;
    //
    //             if(x == i-1) cmin(opt, transition(i+1, k-c0-c1-c2, i, ((s0<<1)|c0)&3, ((s1<<1)|c1)&3, ((s2<<1)|c2)&3));
    //             else cmin(opt, transition(i+1, k-c0-c1-c2, i, c0, c1, c2));
    //
    //             cmax(res, opt);
    //         }
    //     }
    // }

    return res;
}


void solve() {
    re(n, k), rv(3, carton);
    init_precmp();

    for(int r=0; r<3; ++r) for(int c=0; c<n; ++c) carton[r][c] = (carton[r][c] == '.');

    int tot_dots = 0;
    for(int r=0; r<3; ++r) for(int c=0; c<n; ++c) tot_dots += carton[r][c];
    if(tot_dots < k) { ps(-1); return; }

    ps(sqrt(transition(0, k, 0, 0, 0, 0)));
    // ps(sqrt(iterative_transition()));
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    /* cout << fixed << setprecision(6); */
    int t = 1;
    // cin >> t;
    for (int i = 0; i < t; i++) solve();

    return 0;
    // you should actually read the stuff at the bottom
}

/* stuff you should look for
 * int overflow, array bounds
 * special cases (n=1?)
 * do smth instead of nothing and stay organized
 * WRITE STUFF DOWN
 * DON'T GET STUCK ON ONE APPROACH
 */

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 5960kb

input:

5 2
#....
.....
....#

output:

4.472135954999580

result:

ok found '4.4721360', expected '4.4721360', error '0.0000000'

Test #2:

score: 0
Accepted
time: 0ms
memory: 5936kb

input:

5 6
##.##
#####
.....

output:

1.000000000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #3:

score: 0
Accepted
time: 1ms
memory: 3904kb

input:

3 4
..#
...
...

output:

1.414213562373095

result:

ok found '1.4142136', expected '1.4142140', error '0.0000003'

Test #4:

score: 0
Accepted
time: 1ms
memory: 5696kb

input:

2 6
..
.#
..

output:

-1

result:

ok found '-1.0000000', expected '-1.0000000', error '-0.0000000'

Test #5:

score: 0
Accepted
time: 1ms
memory: 5888kb

input:

1 2
.
.
.

output:

2.000000000000000

result:

ok found '2.0000000', expected '2.0000000', error '0.0000000'

Test #6:

score: 0
Accepted
time: 31ms
memory: 27580kb

input:

100 2
....................................................................................................
....................................................................................................
...............................................................................................

output:

99.020199959402220

result:

ok found '99.0202000', expected '99.0202000', error '0.0000000'

Test #7:

score: 0
Accepted
time: 31ms
memory: 27516kb

input:

100 3
....................................................................................................
....................................................................................................
...............................................................................................

output:

49.040799340956916

result:

ok found '49.0407993', expected '49.0407990', error '0.0000000'

Test #8:

score: 0
Accepted
time: 81ms
memory: 87772kb

input:

100 100
....................................................................................................
....................................................................................................
.............................................................................................

output:

2.000000000000000

result:

ok found '2.0000000', expected '2.0000000', error '0.0000000'

Test #9:

score: 0
Accepted
time: 171ms
memory: 117348kb

input:

100 150
....................................................................................................
....................................................................................................
.............................................................................................

output:

1.414213562373095

result:

ok found '1.4142136', expected '1.4142140', error '0.0000003'

Test #10:

score: 0
Accepted
time: 192ms
memory: 117076kb

input:

100 151
....................................................................................................
....................................................................................................
.............................................................................................

output:

1.000000000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #11:

score: 0
Accepted
time: 204ms
memory: 116988kb

input:

100 200
....................................................................................................
....................................................................................................
.............................................................................................

output:

1.000000000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #12:

score: 0
Accepted
time: 165ms
memory: 117872kb

input:

100 201
....................................................................................................
....................................................................................................
.............................................................................................

output:

1.000000000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #13:

score: 0
Accepted
time: 36ms
memory: 41336kb

input:

60 130
............................................................
............................................................
............................................................

output:

1.000000000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #14:

score: 0
Accepted
time: 71ms
memory: 87360kb

input:

100 100
....................................................................................................
####################################################################################################
.............................................................................................

output:

2.000000000000000

result:

ok found '2.0000000', expected '2.0000000', error '0.0000000'

Test #15:

score: 0
Accepted
time: 22ms
memory: 55384kb

input:

100 51
####################################################################################################
....................................................................................................
###########################################################################################...

output:

1.000000000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #16:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

1 2
#
#
#

output:

-1

result:

ok found '-1.0000000', expected '-1.0000000', error '-0.0000000'

Test #17:

score: 0
Accepted
time: 29ms
memory: 54652kb

input:

99 50
###################################################################################################
...................................................................................................
##############################################################################################...

output:

2.000000000000000

result:

ok found '2.0000000', expected '2.0000000', error '0.0000000'

Test #18:

score: 0
Accepted
time: 27ms
memory: 51380kb

input:

100 47
#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.
.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#
#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#...

output:

2.828427124746190

result:

ok found '2.8284271', expected '2.8284270', error '0.0000000'

Test #19:

score: 0
Accepted
time: 36ms
memory: 48228kb

input:

100 43
.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#
#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.
.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#....

output:

2.828427124746190

result:

ok found '2.8284271', expected '2.8284270', error '0.0000000'

Test #20:

score: 0
Accepted
time: 20ms
memory: 27876kb

input:

99 2
#........#............#.#.#...................................#................##..............#...
............................##...#......#...##.............#.........#..#...#............#...#.....
#...............................................#..............#.....#.........#.........#........

output:

98.005101908012932

result:

ok found '98.0051019', expected '98.0051020', error '0.0000000'

Test #21:

score: 0
Accepted
time: 19ms
memory: 24752kb

input:

90 2
#############..######.###.##.#########.###.###########.####.##############################
#...##########.#.#################.############.########################.#################
###################.###.##.####.#######..##.########.#############################.#######

output:

81.006172604314543

result:

ok found '81.0061726', expected '81.0061730', error '0.0000000'

Test #22:

score: 0
Accepted
time: 24ms
memory: 25808kb

input:

95 3
#.#..............#.............#.......#..##.....#.#............#....#..................##.....
.....#.#........#...#...........#......................#...#.....#.........#.....#...........#.
#.......#.#....#.......#.......#.......#..#.#.#.#....#.#...#..#......#........#..........#....#

output:

47.010637094172637

result:

ok found '47.0106371', expected '47.0106370', error '0.0000000'

Test #23:

score: 0
Accepted
time: 21ms
memory: 26004kb

input:

92 3
#########################.###########################.####################################.#
#######.##############.#.#################.#########.########.#############################.
###.##.####.###.####.#####.########.#########.########.##.#######.##########################

output:

42.000000000000000

result:

ok found '42.0000000', expected '42.0000000', error '0.0000000'

Test #24:

score: 0
Accepted
time: 19ms
memory: 26900kb

input:

93 4
##..#.......................#.....#.#.#..............#.....#........#.....................#..
......#...................#..##...................#...............###.....#....#..........#.#
#......#.........#....#.................#......#...#......##..........#.........#.#..#.#..#.#

output:

30.066592756745816

result:

ok found '30.0665928', expected '30.0665930', error '0.0000000'

Test #25:

score: 0
Accepted
time: 26ms
memory: 26936kb

input:

92 4
###.###############.######.##.#########################.######.###.#####.###################
#.##..#####################.###########################.########..###############.#######...
#######################.###.############.##..####.#################.#.#..####.##############

output:

28.017851452243800

result:

ok found '28.0178515', expected '28.0178510', error '0.0000000'

Test #26:

score: 0
Accepted
time: 23ms
memory: 27116kb

input:

94 5
#........#....#.................................................#.....................#.......
#................#...............#..##..................#........#.......#...#................
##..................................................##................#.......#...............

output:

23.021728866442675

result:

ok found '23.0217289', expected '23.0217290', error '0.0000000'

Test #27:

score: 0
Accepted
time: 0ms
memory: 3844kb

input:

1 2
#
.
.

output:

1.000000000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #28:

score: 0
Accepted
time: 18ms
memory: 26348kb

input:

94 5
##..#.######.##.########.#####.#####.############..##.##############################..########
#######.########.##########.#..################.####.#.###...######..##.######################
######.############.######.#####################.################.##.##############.##########

output:

18.027756377319946

result:

ok found '18.0277564', expected '18.0277560', error '0.0000000'

Test #29:

score: 0
Accepted
time: 20ms
memory: 27556kb

input:

90 6
#.................#....................#................#.#.........###...................
....................................#........#...................#...##...##....#.....#...
#.#...........#...#........#..#....#.#....................#.........#.....................

output:

17.117242768623690

result:

ok found '17.1172428', expected '17.1172430', error '0.0000000'

Test #30:

score: 0
Accepted
time: 19ms
memory: 28316kb

input:

100 6
##########.##.##################.###########.###########.##.######################.####.##.#########
##########...#########.#.########.#################.#.###########.#.##########.#.##.################
##############.#####..#######..##################.#######################.########.#########...

output:

16.031219541881399

result:

ok found '16.0312195', expected '16.0312200', error '0.0000000'

Test #31:

score: 0
Accepted
time: 28ms
memory: 28156kb

input:

92 7
#.#....#..#...#.......#.........................................#.......#...#.............#.
...............#......#............#...#.........................#.....#..............#.....
#..#......#...............#.................#....#............................#.............

output:

15.132745950421556

result:

ok found '15.1327460', expected '15.1327460', error '0.0000000'

Test #32:

score: 0
Accepted
time: 21ms
memory: 27492kb

input:

92 7
##.###########..######.###############.#.##.#################.##.#############.######.###.##
#############.###############.##..#####################.######.#..#########.###.############
.###.########.###################.########.###################..#######...#########.#####.##

output:

14.035668847618199

result:

ok found '14.0356688', expected '14.0356690', error '0.0000000'

Test #33:

score: 0
Accepted
time: 21ms
memory: 28072kb

input:

91 8
#..................#..#..............#......................#.......#..........#...#..#....
#....#.#.....#..#......#.....#.................#..#...........................#.........#..
#.......#......#..........#............#.....#...................#..............#.....#....

output:

12.165525060596439

result:

ok found '12.1655251', expected '12.1655250', error '0.0000000'

Test #34:

score: 0
Accepted
time: 21ms
memory: 28328kb

input:

93 8
############.###########.#######################.############.##.###.######################.#
############.####.###########.#######.####.##########.#######.####.###################.####..
#####.#######.###########.#####.#############.#.##################.##########################

output:

8.062257748298549

result:

ok found '8.0622577', expected '8.0622580', error '0.0000000'

Test #35:

score: 0
Accepted
time: 94ms
memory: 84680kb

input:

100 109
..#.....#..............#....................#..#.......#.............#................#.#...........
#............##.........#..........#.#....#...............#...#.......#................#...........#
.....#..#......#................................................................#............

output:

1.414213562373095

result:

ok found '1.4142136', expected '1.4142140', error '0.0000003'

Test #36:

score: 0
Accepted
time: 23ms
memory: 32144kb

input:

97 13
..##...#..........#.........##....##......#............#..........###........#.....#.........#...
##..#....#.............#....#...#.##............#........#.#.#.....................#.......#..#..
........#..#....##.........#.#....#.....#.......#.#...................#......#.......#......##...

output:

8.062257748298549

result:

ok found '8.0622577', expected '8.0622580', error '0.0000000'

Test #37:

score: 0
Accepted
time: 35ms
memory: 54844kb

input:

100 50
....#......#..................#.......#..#.....#........#.........#......#....#............##.......
#.....##........#.#...........##..#....##....#.#.........##....#.##...........#.....................
......##........#...#....#...#...#............#.......##.#..........##......##....##..#...#...

output:

2.236067977499790

result:

ok found '2.2360680', expected '2.2360680', error '0.0000000'

Test #38:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

1 3
#
.
.

output:

-1

result:

ok found '-1.0000000', expected '-1.0000000', error '-0.0000000'

Test #39:

score: 0
Accepted
time: 61ms
memory: 75072kb

input:

92 107
..#........#...#...#.....#....#........#...#.......#.........#..#.........#...##.......##.#.
..##.......#..#....##.#..##.#.##........#............#..#.......#..##..............#....#...
#...#.....#..........#........#.....##.#.................#....##...........#............#...

output:

1.414213562373095

result:

ok found '1.4142136', expected '1.4142140', error '0.0000003'

Test #40:

score: 0
Accepted
time: 112ms
memory: 95096kb

input:

95 125
...##.......#..#.#.............#..##...#..................#......#...##..#.....##....#.......#.
.........#.....#.#....#....#..##.....#...#...#......#...........##..#........#.#...#.#........#
.#..#....................##.........#...#...........#...........#...#...#..........##.....#.##.

output:

1.000000000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #41:

score: 0
Accepted
time: 32ms
memory: 35164kb

input:

93 20
#############################################################################################
.#.....#.......###.#..#.###....#...............##...#.....#..#...#...........#.....#....#..#.
....##.....#....#.#......#......#...........#.....#................#......#...#.##........#..

output:

4.123105625617661

result:

ok found '4.1231056', expected '4.1231060', error '0.0000001'

Test #42:

score: 0
Accepted
time: 24ms
memory: 37112kb

input:

97 21
#################################################################################################
#################################################################################################
......###........#.....#...#.#.........##.#......#.####.##......#....#........#...##....#......#.

output:

4.000000000000000

result:

ok found '4.0000000', expected '4.0000000', error '0.0000000'

Test #43:

score: 0
Accepted
time: 18ms
memory: 27328kb

input:

93 7
#...#..##..#..#....#...#......#...####.###..##.##.#..#.#.###.##......#..###....#.#..#.#.#...#
.#.#....##..##.##.#...##..##.#..............####.....##.#.#.#.#.#..##....#...#.#.#.......#...
###.###......#.#.#.#...###....#.#.##..#..#...#...#.##.#..##...#.####.#..##.#.###....#.#...#.#

output:

15.132745950421556

result:

ok found '15.1327460', expected '15.1327460', error '0.0000000'

Test #44:

score: 0
Accepted
time: 14ms
memory: 32132kb

input:

91 15
.##.#..#......#.#####..###....##..#.#...#..##..#.##.....#....#.######.#.#.#......##..##..#.
..#..########....#..#...#.###.#............#.#.#..#..#..#.#.##...##....###.#...#.###..####.
...#.##..####..#.#.#.....#.#..#.#...##.##.#....#....#..#..##.......#####..###.#.#.#.##...#.

output:

6.324555320336759

result:

ok found '6.3245553', expected '6.3245550', error '0.0000001'

Test #45:

score: 0
Accepted
time: 28ms
memory: 59352kb

input:

98 58
.#..##.....#............###.#####.##.....#.#..#.#.....####..##.##.#.......##...##..#..#....#..#..#
#.#.##.#.#...#.....###...#....##..#..#...#####.##.#.#..#.#.##.#...####.##.#.....###.##.###.#....#.
....#..##..##.##..##...#..#....#.......###...#....#.##..#...#..#.....#....#.#.......####.#.#..#.#.

output:

2.236067977499790

result:

ok found '2.2360680', expected '2.2360680', error '0.0000000'

Test #46:

score: 0
Accepted
time: 35ms
memory: 74404kb

input:

92 92
.#.#####.......##.##.....#####.....#..#..##.#..###..###.#..#..#.###..##...##..#.#.##..#.....
#..#...#..........##.##.#.#..#.#..#..##..#...#..###.#.#....#..#.#..#..#.##........#....##.##
.........####..#...#.....###...###.##..#.##.#####...##...##.#....#.##..##.##.######.#.#...#.

output:

1.000000000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #47:

score: 0
Accepted
time: 27ms
memory: 46704kb

input:

94 40
##############################################################################################
.#.........#.....##.########..#.....##..###..##.#.#..#.####..##...#..#..#....##.#..#....####.#
...#..#.##.#......#......####.....#.#..#.#.#..###.#..#.......##.#.###.#..##......#####.#..#..#

output:

2.000000000000000

result:

ok found '2.0000000', expected '2.0000000', error '0.0000000'

Test #48:

score: 0
Accepted
time: 29ms
memory: 35016kb

input:

95 21
###############################################################################################
###############################################################################################
..#..#.#....#.#..##.##..#.#.#.##.#.......##.#...#...#.##...#..#..###.#...#......#..##.......#.#

output:

4.000000000000000

result:

ok found '4.0000000', expected '4.0000000', error '0.0000000'

Test #49:

score: 0
Accepted
time: 0ms
memory: 3816kb

input:

1 3
.
.
.

output:

1.000000000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #50:

score: 0
Accepted
time: 23ms
memory: 27360kb

input:

99 4
#...##.#.####.############.##.###..###.###.##.#.###.#####..#.#..#..#.#..###..##...#.#.#..##########
.##..##.###..##.#.#.#######..##...###..#.##.#.##..#...###...#.###...#####.######..#..########.##.#.
#######.##.####..##.##.#...#.###.###..####..###.######..###.##.#.#..#..#.#.###.#.###.#######.##...

output:

32.015621187164243

result:

ok found '32.0156212', expected '32.0156210', error '0.0000000'

Test #51:

score: 0
Accepted
time: 23ms
memory: 32628kb

input:

100 12
#.###.####...######.###.########.#.##.#..#......##...#####.#.#..#.#..##.##.#.##.###.##.#########..##
#.###..###.#####.##.#..##..#.###....###...##.##.#..#.#.#.##....#..#.#.#####.#.#########..#.#..#..###
#.#.######.########...#...##.#..#.##.####..#.#.#..#.###...#.#.#..###....#...####.#.##..###....

output:

8.246211251235321

result:

ok found '8.2462113', expected '8.2462110', error '0.0000000'

Test #52:

score: 0
Accepted
time: 25ms
memory: 47964kb

input:

100 36
..######.#.#####.##.##.#.#######.####.#.######.##.#...####.####....##.#.....##..#########..###.#.###
##.######.#.###.####.##..#..##.##..#.#######.##.######.#...#.##.##.#.#..#..####.###.#..#####.#.####.
##.###.#..#.#####.#....###..#....#.#...#...#.##..###.##.########.##.##.########.#####.####....

output:

2.236067977499790

result:

ok found '2.2360680', expected '2.2360680', error '0.0000000'

Test #53:

score: 0
Accepted
time: 27ms
memory: 68740kb

input:

97 74
..####.#..#.###.##...##.#########...#.....##.##.#####.#.###..##..##...###.#.##...####...##.###.##
..##....#.##.###.###..###..#..#..#####.###..#.##..#####.####.###..##.##...#..###.#####.########.#
...##.#.###.#.##.####.#..##.###.######..#.####.####..########..##.#.###..##..###..#..##.#.##..##.

output:

1.000000000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #54:

score: 0
Accepted
time: 30ms
memory: 42240kb

input:

97 28
#################################################################################################
.###.##.##...########.##.###.#..#.###.#.#..#.##..##.#.##...##..#...##....#...##########.#####.###
.##.#####..##..#.####.##.#.###.###....##.##.########..###.####..####.###.##..#.#..###..####....##

output:

2.236067977499790

result:

ok found '2.2360680', expected '2.2360680', error '0.0000000'

Test #55:

score: 0
Accepted
time: 26ms
memory: 29420kb

input:

90 13
##########################################################################################
##########################################################################################
.##.###..####.####.###..###..###..#.##.#.##..###.###.###..#.#.####.#.###.#..#.######.....#

output:

5.000000000000000

result:

ok found '5.0000000', expected '5.0000000', error '0.0000000'

Test #56:

score: 0
Accepted
time: 20ms
memory: 27712kb

input:

94 4
###.#############..####..#.####.#####.################.####.#######..######.######.###########
.##############.#####.###.####.##..##########.#.##########.#####.##.####.#####.######.########
#.######.#######..###.########.##.##########.##########.####.######.##..##.##.#####.###.######

output:

28.071337695236398

result:

ok found '28.0713377', expected '28.0713380', error '0.0000000'

Test #57:

score: 0
Accepted
time: 20ms
memory: 32220kb

input:

100 9
###########.######.#.#.#.###.#####..##.###########..#######.#..####..############.#..#..#.##.#######
.####.##..#.####.#####.##.###.###.################.####.###.##..############################.##.####
###.######...####..#####.#..#.##.##.#.##..#######.#######.#####..############.#####.##.#####...

output:

9.219544457292887

result:

ok found '9.2195445', expected '9.2195440', error '0.0000000'

Test #58:

score: 0
Accepted
time: 20ms
memory: 38224kb

input:

93 27
##..###.#.#.#####.#############.###.###############.##.##.###########.#.#######..####.#..####
####.#.#####.#.###..####.##.##.#..####.#..##########..######.#########.######.##########..##.
#####...#####################...####.##.#.#####.######.#.###.##.#..########.#.###.#.####..#.#

output:

2.236067977499790

result:

ok found '2.2360680', expected '2.2360680', error '0.0000000'

Test #59:

score: 0
Accepted
time: 20ms
memory: 41288kb

input:

93 34
#######.#######.##.#.#.#####.##.#################.########...#######.#.#.#..#.##########.####
###...########.##########.##.########.#..##.####.##.#####..######..###.#####..#.###.####.####
#######.#########.#..#####.##.####.##.###.##.###.##.#.#...###.#.######.#####.###.##########.#

output:

2.236067977499790

result:

ok found '2.2360680', expected '2.2360680', error '0.0000000'

Test #60:

score: 0
Accepted
time: 0ms
memory: 3960kb

input:

3 3
.##
.##
.##

output:

1.000000000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #61:

score: 0
Accepted
time: 22ms
memory: 31988kb

input:

94 14
##############################################################################################
##.#####.####.###.########.########.##.##.#######.##.#..#.#####.#.#.###########.#####.##.###.#
#.#.############.############.###.######..##.#######.##.###.####..#.#####.#####.######..#.#.##

output:

5.099019513592784

result:

ok found '5.0990195', expected '5.0990200', error '0.0000001'

Test #62:

score: 0
Accepted
time: 20ms
memory: 27096kb

input:

100 4
####################################################################################################
####################################################################################################
#########..###.####..#.####..#.##.#########.#.####..########.####.#.##.######..#####.#####.....

output:

25.000000000000000

result:

ok found '25.0000000', expected '25.0000000', error '0.0000000'

Test #63:

score: 0
Accepted
time: 21ms
memory: 24972kb

input:

99 208
.......###.##........###.....#...#.##..#.##.#.....#...#.#........#...##..##..#........#.###.#.#..#.
........#.##.#.#.....#..............###....#.........#.#....#..#........#.#..#.#..........#.#..#..#
#.##...#....#.##.#....##.#..#...#.##.#...##...#.#.#......#.....####.#.#.#.....#..#..#...#.......

output:

-1

result:

ok found '-1.0000000', expected '-1.0000000', error '-0.0000000'

Test #64:

score: 0
Accepted
time: 20ms
memory: 45704kb

input:

100 30
##################################################...##.#........#.###.#..#.......#..#....##########
........................................########..#..........#..#..###......#..........#..##########
################################################..#...##.........##.#..#.##....#..........#...

output:

2.828427124746190

result:

ok found '2.8284271', expected '2.8284270', error '0.0000000'

Test #65:

score: 0
Accepted
time: 29ms
memory: 44704kb

input:

100 30
.#..######..###..#######.#######...#.###.##.###.#.#..##.#######.#...............##.##.######.###...#
#.....#..#..####..####.##...##.#####..####..##..#..####..#####......#.....#.....########...###.#.###
.#.#.#.###.#...#..##.####..####.#.##..####..####.###..########.....#...#.......####.##.####...

output:

3.000000000000000

result:

ok found '3.0000000', expected '3.0000000', error '0.0000000'

Test #66:

score: 0
Accepted
time: 160ms
memory: 115796kb

input:

100 281
..............................................................................................######
..............................................................................................######
.............................................................................................

output:

1.000000000000000

result:

ok found '1.0000000', expected '1.0000000', error '0.0000000'

Test #67:

score: 0
Accepted
time: 171ms
memory: 115240kb

input:

99 149
...................................................................................................
...................................................................................................
................................................................................................

output:

1.414213562373095

result:

ok found '1.4142136', expected '1.4142140', error '0.0000003'

Test #68:

score: 0
Accepted
time: 180ms
memory: 116956kb

input:

100 150
....................................................................................................
....................................................................................................
.............................................................................................

output:

1.414213562373095

result:

ok found '1.4142136', expected '1.4142140', error '0.0000003'