QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#501268#5153. Delft DistancexixuRE 240ms188480kbC++204.5kb2024-08-02 16:12:512024-08-02 16:12:51

Judging History

你现在查看的是最新测评结果

  • [2024-08-02 16:12:51]
  • 评测
  • 测评结果:RE
  • 用时:240ms
  • 内存:188480kb
  • [2024-08-02 16:12:51]
  • 提交

answer

#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int , int> PII;


const int M = 1e7 + 10 , inf = 0x3f3f3f3f , N = 1500;
const double PI = 3.1415926535;


typedef pair<int, int> PII;
typedef pair<double , pair<int , int>> PL;

int n , m;      // 点的数量
PII e[M];
int ne[M];
double w[M];
int idx;       // 邻接表存储所有边
int h[N][N];
double dist[N][N];
bool st[N][N];
// double dist[N];        // 存储所有点到1号点的距离
// bool st[N];     // 存储每个点的最短距离是否已确定

void add(PII a , PII b , double c)
{
    e[idx] = b;
    w[idx] = c;
    ne[idx] = h[a.first][a.second];
    h[a.first][a.second] = idx ++;
}

// 求1号点到n号点的最短距离,如果不存在,则返回-1
double dijkstra()
{
    // memset(dist, 0x3f, sizeof dist);
    for(int i = 1; i <= 2 * n + 2; i ++)
    {
        for(int j = 1; j <= 2 * m + 2; j ++)
        {
            dist[i][j] = inf;
        }
    }
    dist[1][1] = 0;

    priority_queue<PL, vector<PL>, greater<PL>> heap;
    heap.push({0, {1 , 1}});      // first存储距离,second存储节点编号

    while (heap.size())
    {
        auto t = heap.top();
        heap.pop();
        // cout << t.second.first << ' ' << t.second.second << '\n';

        PII ver = t.second;
        double distance = t.first;

        if (st[ver.first][ver.second]) continue;
        st[ver.first][ver.second] = true;

        for (int i = h[ver.first][ver.second]; i != -1; i = ne[i])
        {
            PII j = e[i];
            if (dist[j.first][j.second] > distance + w[i])
            {
                dist[j.first][j.second] = distance + w[i];
                heap.push({dist[j.first][j.second], j});
            }
        }
    }

    return dist[2 * n + 1][2 * m + 1];
}





void solve()
{
    
    cin >> n >> m;

    for(int i = 0; i <= 2 * n + 2; i ++)
    {
        for(int j = 0; j <= 2 * m + 2; j ++)
        {
            h[i][j] = -1;
        }
    }

    for(int i = 1; i < 2 * n; i += 2)
    {
        for(int j = 1; j < 2 * m; j += 2)
        {
            // cout << i << ' ' << j << '\n';
            char c;
            cin >> c;
            if(c == 'X')
            {
                add({i , j} , {i , j + 2} , 10);
                add({i , j + 2} , {i , j} , 10);

                add({i , j} , {i + 2 , j} , 10);
                add({i + 2 , j} , {i , j} , 10);

                add({i , j + 2} , {i + 2 , j + 2} , 10);
                add({i + 2 , j + 2} , {i , j + 2} , 10);

                add({i + 2 , j} , {i + 2 , j + 2} , 10);
                add({i + 2 , j + 2} , {i + 2 , j} , 10);
            }
            else
            {
                add({i ,j} , {i + 1 , j} , 5);
                add({i + 1 , j} , {i , j} , 5);

                add({i + 1 , j} , {i + 2 , j} , 5);
                add({i + 2 , j} , {i + 1 , j} , 5);

                add({i + 2 , j} , {i + 2 , j + 1} , 5);
                add({i + 2 , j + 1} , {i + 2 , j} , 5);

                add({i + 2 , j + 1} , {i + 2 , j + 2} , 5);
                add({i + 2 , j + 2} , {i + 2 , j + 1} , 5);

                add({i + 2 , j + 2} , {i + 1 , j + 2} , 5);
                add({i + 1 , j + 2} , {i + 2 , j + 2} , 5);

                add({i + 1 , j + 2} ,{i , j + 2} , 5);
                add({i ,j + 2} , {i + 1 , j + 2} , 5);

                add({i , j + 2} , {i , j + 1} , 5);
                add({i , j + 1} , {i , j + 2} , 5);

                add({i , j + 1} , {i , j} , 5);
                add({i , j} , {i , j + 1} , 5);

                add({i + 1 , j} , {i , j + 1} , 5 * PI / 2);
                add({i , j + 1} , {i + 1 , j} , 5 * PI / 2);

                // cout << 5 * PI / 2 << '\n';
                add({i , j + 1} , {i + 1 , j + 2} , 5 * PI / 2);
                add({i + 1 , j + 2} , {i , j + 1} , 5 * PI / 2);

                add({i + 1 , j + 2} , {i + 2 , j + 1} , 5 * PI / 2);
                add({i + 2 , j + 1} , {i + 1 , j + 2} , 5 * PI / 2);

                add({i + 2 , j + 1} , {i + 1 , j} , 5 * PI / 2);
                add({i + 1 , j} , {i + 2 , j + 1} , 5 * PI / 2);
            }

        }
    }

    cout << fixed << setprecision(12) << dijkstra() << '\n';


}



signed main()
{
    cin.tie(0);cout.tie(0);
    ios::sync_with_stdio(false);

    int t = 1;
    // cin >> t;
    while(t --)
    {
        solve();
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 5
XOOXO
OXOXO
XXXXO

output:

71.415926535000

result:

ok found '71.4159265', expected '71.4159265', error '0.0000000'

Test #2:

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

input:

1 4
XOOX

output:

45.707963267500

result:

ok found '45.7079633', expected '45.7079633', error '0.0000000'

Test #3:

score: 0
Accepted
time: 2ms
memory: 11992kb

input:

1 1
X

output:

20.000000000000

result:

ok found '20.0000000', expected '20.0000000', error '0.0000000'

Test #4:

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

input:

1 1
O

output:

17.853981633750

result:

ok found '17.8539816', expected '17.8539816', error '0.0000000'

Test #5:

score: 0
Accepted
time: 2ms
memory: 12080kb

input:

1 3
XOO

output:

35.707963267500

result:

ok found '35.7079633', expected '35.7079633', error '0.0000000'

Test #6:

score: 0
Accepted
time: 2ms
memory: 11980kb

input:

1 5
OXOOO

output:

55.707963267500

result:

ok found '55.7079633', expected '55.7079633', error '0.0000000'

Test #7:

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

input:

6 10
XXXXXOOOOX
XXOOOOOOOO
XXXOXOOXOX
OXOXOXXOOX
OOXXOXXXXO
OXOXXOOXOO

output:

142.831853070000

result:

ok found '142.8318531', expected '142.8318531', error '0.0000000'

Test #8:

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

input:

1 2
XX

output:

30.000000000000

result:

ok found '30.0000000', expected '30.0000000', error '0.0000000'

Test #9:

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

input:

10 1
X
X
X
O
O
O
X
O
O
X

output:

105.707963267500

result:

ok found '105.7079633', expected '105.7079633', error '0.0000000'

Test #10:

score: 0
Accepted
time: 2ms
memory: 14048kb

input:

18 6
OOOOOO
OOOOOO
XOOOOO
OOOOXO
OOOXOO
OOOOOO
OOOOOO
OOOOOO
OOOOOX
OOOOOO
OOOXOO
OOOOOO
OOOOOO
OOOOOO
OOOOOO
OOOOOO
OOOOOO
OOOOOO

output:

214.247779605000

result:

ok found '214.2477796', expected '214.2477796', error '0.0000000'

Test #11:

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

input:

40 9
OOOOXOXXX
XOXXXOXXO
OXOXXXXXO
OXOXXXOXX
XXXXOXOXX
XXOOXOXXX
XOOXOXXXX
XOXXOOXOX
OXXOOOOXX
XXOOOXXOO
OXOOXOXXX
OOOOOXOOO
OXXXXXXXO
OOOOOOOXX
OOOXXXOOX
OXOXXOOOO
OOOOXOXOO
OXOXOOOXO
OXXOOXXXO
OXOOXOOXO
XXXOXOXOO
XXOOOXOOX
OOXXOOXOO
XOOXXXXOX
OXXXXOOOO
OXOOOOXOX
XXOXXXOOO
OOXOOOXXX
OXOOOOXOO
OXOOO...

output:

453.517687773750

result:

ok found '453.5176878', expected '453.5176878', error '0.0000000'

Test #12:

score: 0
Accepted
time: 2ms
memory: 14304kb

input:

41 50
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXO
XXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXOXXXXXXXXXXXXXXX
XXXXXXXXXXXXXOXXXXXXXXXXXXXXOXXXXXXXXXX...

output:

873.517687773750

result:

ok found '873.5176878', expected '873.5176878', error '0.0000000'

Test #13:

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

input:

329 527
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

8560.000000000000

result:

ok found '8560.0000000', expected '8560.0000000', error '0.0000000'

Test #14:

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

input:

49 297
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

3451.415926535000

result:

ok found '3451.4159265', expected '3451.4159265', error '0.0000000'

Test #15:

score: 0
Accepted
time: 3ms
memory: 30936kb

input:

357 83
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

4342.057504111252

result:

ok found '4342.0575041', expected '4342.0575041', error '0.0000000'

Test #16:

score: 0
Accepted
time: 65ms
memory: 75820kb

input:

417 615
XXXXXXXXOXXXXXXXXXXXOXXXXXXXXXXXOXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXOXXXXXXXXXXXXXXOXXXXXOXXXOOXXXXXXXXXXXXXXXXXXXXXOXOXXOXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXOXXXXXXOXXXXXXXXOXXXXXXXOXXXXXXXXXXXXXXXXOXXXXXXOXXXXXXXOXXXXXXXXXXOXXXXXXXXOXXXOXXXOXXXXXOXXXOXXXXXXXXXOXXXXXXXXXXXXXXXXXXXX...

output:

9736.283004380010

result:

ok found '9736.2830044', expected '9736.2830044', error '0.0000000'

Test #17:

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

input:

359 225
OOOOXXOOXOXXXOOOOOXOXOOOXOOXXXXXOOOXOXXXOOOOXXOXXOOXOXOXXOXOXXXOXXXXXOOOXXXXXXXOOOOXXXXXOOXOXXOXOXOXXOXOXXOXOXOOOXOXXXOOXOXOXXXXOXOOXXOXXOXOXOXXOXXXOOOXXOOOXXOXXXXXOXOXOOXXOOXOXXOXXOOOOOXOXOOXXXOOXOOXOOOOXOXOOXXOOOXOOOXXXXOXX
OXOOOXXXOOXOOXOOXXOOXXOOXXOXXOOOOOXOXXOOXXXOXXXOXOOOXOOXXOOXOXXOXO...

output:

5026.659039191263

result:

ok found '5026.6590392', expected '5026.6590393', error '0.0000000'

Test #18:

score: 0
Accepted
time: 59ms
memory: 66356kb

input:

261 431
OOOOOOOXOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOXOOOOOOXOOOXXOOOOOOOOOOOOOOXOOXOOOOOOXOOOOOOOOOXOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOXOXOOOOOOOOOOOOOXOOOXOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOXXOOXOOOOOOOOOOOXOOXOOOOXOXXOOOOOOOOOOXOXOOOOOOOOOOOOOXOOOOOOOOOOOOOXOOOOOOOOXOOOOOOOOOOO...

output:

5799.778412817474

result:

ok found '5799.7784128', expected '5799.7784129', error '0.0000000'

Test #19:

score: 0
Accepted
time: 6ms
memory: 18232kb

input:

37 427
OOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO...

output:

4481.194640897487

result:

ok found '4481.1946409', expected '4481.1946409', error '0.0000000'

Test #20:

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

input:

105 430
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO...

output:

4899.336143087473

result:

ok found '4899.3361431', expected '4899.3361431', error '0.0000000'

Test #21:

score: 0
Accepted
time: 125ms
memory: 130128kb

input:

465 484
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO...

output:

7494.202919387440

result:

ok found '7494.2029194', expected '7494.2029196', error '0.0000000'

Test #22:

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

input:

266 8
OXOOXXOX
OOXOXXXX
XXXXOXXX
XXOOOOXX
XXOXXXOO
OXOXXOXO
XXOXOXXO
OOOXOXOO
OXOXOXOO
XOOXOOXX
XXOXOXXO
OXOOOOXO
XXOOXOOO
OXOOXXXX
XOOOXOXO
XOXOOXOX
OOXOOXOX
XXOOOXXO
XOOXXOXX
XOXOXOXX
OXOOOOOO
XOOXOXOX
OXXXOOXX
XXXOOXOO
XOOOXXOO
OXXXXXXO
OXOXXOOX
OXXOXXOX
OXOXOOXO
XXXOXOOO
OXOXOOXO
OXXXOXXX
XXXXOX...

output:

2705.663706140000

result:

ok found '2705.6637061', expected '2705.6637061', error '0.0000000'

Test #23:

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

input:

366 8
XXXXXXXO
XXXXXXXX
XXXXXXXX
XXXXXXXX
XXXXXXOX
XXXXOXXX
XOXXXXXO
XXXXOXXX
OXXXXOXX
XXXXXXXX
XXXXXXXX
OXXXXXXX
XXXXXXXX
XXXOXXXX
XXOXXXXX
XXXOXXOX
XXXOXXXX
XXXXOXXX
XXXXXXXX
XXXXXXOO
XXXXXXXX
XXXXXXXX
XXXXOXXX
XXXXXXXX
XOXXXXXX
XXXXXXXX
XXXXXXXX
XOXXXOXX
XXXXXXXX
XXXXXXXX
XXXXXXXX
XXXXXXXX
XXXXXX...

output:

3712.101761238751

result:

ok found '3712.1017612', expected '3712.1017612', error '0.0000000'

Test #24:

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

input:

56 2
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XO
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX

output:

577.853981633750

result:

ok found '577.8539816', expected '577.8539816', error '0.0000000'

Test #25:

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

input:

437 2
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
OX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
XX
...

output:

4385.707963267500

result:

ok found '4385.7079633', expected '4385.7079633', error '0.0000000'

Test #26:

score: 0
Accepted
time: 2ms
memory: 12040kb

input:

4 204
OXOOXXXOOOXOOXXOXOXXXXOXXXXOXXXOXXOXXOXOOXOOOOXXXOXOXXXOXOOOOOXOXXXOOXOXXXXOXOOXXXOXOXOXXXOXOXXOOOXOOOXOXXXOXOOXXOOXOOOOOXOOOOOOXOXOXXOOOXXXXOOOXOOOXOOOOXXOXXOOXOXXOXOOXOOXXXOOXXOOXXXXOOOXOXXXXOOXXOOOOXXO
OXXXXXOOXOOXOXOOXOXOOOOXXOXOOOOOXOOOXOOOXOXXXOXXOXXXOOXOOXXXXXOXOXXXXXXOOXXOXXXXXOXOXOOXO...

output:

2062.831853070000

result:

ok found '2062.8318531', expected '2062.8318531', error '0.0000000'

Test #27:

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

input:

4 164
XXXXXXXXXXXXOXXXXOXXXXXXXXXXXXXXXXXXXXXXOXOXOOXOXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXOXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXOXXXXXXXXXXXXXXXXOXXXO
XXXOXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXOXXXXXXXXXXXXOOXXXXXXOXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXOXXX...

output:

1662.831853070000

result:

ok found '1662.8318531', expected '1662.8318531', error '0.0000000'

Test #28:

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

input:

10 243
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

2514.977871436250

result:

ok found '2514.9778714', expected '2514.9778714', error '0.0000000'

Test #29:

score: 0
Accepted
time: 2ms
memory: 12208kb

input:

7 478
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

4847.853981633750

result:

ok found '4847.8539816', expected '4847.8539816', error '0.0000000'

Test #30:

score: 0
Accepted
time: 84ms
memory: 73324kb

input:

400 400
OOOXXOXOXXXXXOXOXXOOXXXXOOXXXOXXOOXOXOOXOXOOOXXOXXOOOOXXOXOOXOXOXOXXXOOXOXOOXOOXXXOXXXXXXOOXXXXOXOXXXOOXOXOXXOOOOXXXXXOOXXXXXXXOOOXOXXXOXXOOOOXXOXXOXXOOOOXXOXOXOOXXOOXXXOOXOOOXXXXXXOOOXXOXOXOXOOOXOXOXXXXXXXXOXOOOXOXXOOXOXXXXOOXXXXXXOXOOXXXOXOOOOOXOXXOXXXXOOOXXOXOOOXOXOOOOXXXXOXXOXOOOOXOOXOXO...

output:

6823.981935294978

result:

ok found '6823.9819353', expected '6823.9819354', error '0.0000000'

Test #31:

score: 0
Accepted
time: 101ms
memory: 96804kb

input:

400 400
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO...

output:

6285.331325366232

result:

ok found '6285.3313254', expected '6285.3313255', error '0.0000000'

Test #32:

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

input:

400 400
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...

output:

8000.000000000000

result:

ok found '8000.0000000', expected '8000.0000000', error '0.0000000'

Test #33:

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

input:

400 400
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXX...

output:

7854.070751094995

result:

ok found '7854.0707511', expected '7854.0707511', error '0.0000000'

Test #34:

score: 0
Accepted
time: 88ms
memory: 87300kb

input:

400 400
OOOOOOOXOOOOXOOOOXOXOOOOOOXOOOOOOOXOOOOOOOOOOXOOOOXOOOXOOXOOOOOOOOOOOXOOXOXOOOOOOOOOOOOOOXOOXXOXOOOOOOXOXOOOXOOOOOOOXXOOOXOOOXOXOOOOXOOOOOOOOOOOXXOXOOOXXOOOOOOOOOOOOXOOOOXOOOXOOXOOOXOOOOOXXOOOXOOOOOOOOOOOOOOXOOOOOOOXXOOOOXXOOOOOOOOXOOOOOXOOOXOOXOOOOOOOOXOOOOOOXOOOOOOOOXOXOOOOOXXOOOOOOOOOXXXO...

output:

6478.472978328728

result:

ok found '6478.4729783', expected '6478.4729785', error '0.0000000'

Test #35:

score: 0
Accepted
time: 240ms
memory: 188480kb

input:

700 700
XXXOXOXOXOOXOOXXXOOOOOXXXXOXOXOOXXOXXXOOOOOXXOXOXXXXOOOXXOXXXOXXXXXOXXXOOXXOOXOOXOXXOOXXXOOOXOOOOXXOXOOXOOXXOOXOOOXXXXOXOXOXOOOXOOXOOXXOOOXOOXOOOOXXXXXXOOXOOXXXOOOOXOOXOOXOXOOOOXOXOOXXXOXXOXOXOXXXXXOXXOOOOXXXOXOXXXOXXXXOOOXXXOXXOXXOXOOOOOOXOXOXOXXXXOXXOXXOXXOOOXXOOXOXXXOXOXOOOXOOXOOOOXOOOOOO...

output:

11922.654221470149

result:

ok found '11922.6542215', expected '11922.6542217', error '0.0000000'

Test #36:

score: -100
Runtime Error

input:

700 700
OOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO...

output:


result: