QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#501393#5153. Delft DistanceRailgun2334RE 0ms4940kbC++171.7kb2024-08-02 17:43:082024-08-02 17:43:08

Judging History

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

  • [2024-08-02 17:43:08]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:4940kb
  • [2024-08-02 17:43:08]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define i128 __int128
#define pll pair<ll,ll>
#define pii pair<int,int>
#define ull unsigned long long
/*------------C-O-D-E------------*/
const int N = 1e5 + 4;
//int n, m, M, mod=998244353;
int n,m;
int dx[5]={1,0};
int dy[5]={0,1};
string s[705];
int ans=0;
void dfs(int x,int y,int flag,int sumo)
{
    if(s[x][y]=='X')
    {
        for(int i=0;i<=1;i++)
        {
            int xx=x+dx[i];
            int yy=y+dy[i];
            if(xx<=n&&yy<=m)
            {
                dfs(xx,yy,flag,sumo);
            }
        }
    }
    else
    {
        if(y+1<=m)
        {
            dfs(x,y+1,flag,sumo);
        }
        if(s[x][y+1]=='O')
        {
            if(x+1<=n)
            {
                dfs(x+1,y+1,flag,sumo+2);
            }
            else if(flag==0)
            {
                dfs(x,y+1,1,sumo+2);
            }
            else if(flag==1)
            {
                dfs(x,y+1,1,sumo);
            }
        }
        else
        {
            if(x+1<=n)
            {
                dfs(x+1,y,flag,sumo+1);
            }
            else if(flag==0)
            {
                dfs(x,y+1,1,sumo+1);
            }
            else if(flag==1)
            {
                dfs(x,y+1,1,sumo);
            }
        }
    }
    ans=max(ans,sumo);
}
void solve()
{
    cin>>n>>m;
    for(int i=1;i<=n;i++)
    {
        cin>>s[i];
        s[i]="#"+s[i];
    }
    dfs(1,1,0,0);
    long double anss=0;
    long double pi=3.1415926535;
    long double d=10-2.5*pi;
    anss=(n+m)*10-ans*d;
    printf("%.10Lf",anss);
}
int main()
{
	ll T = 1;
	//cin>>T;
	while (T--)
	{
		solve();
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 5
XOOXO
OXOXO
XXXXO

output:

71.4159265350

result:

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

Test #2:

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

input:

1 4
XOOX

output:

45.7079632675

result:

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

Test #3:

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

input:

1 1
X

output:

20.0000000000

result:

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

Test #4:

score: -100
Runtime Error

input:

1 1
O

output:


result: