QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#501359#5153. Delft DistanceRailgun2334WA 2ms6456kbC++201.8kb2024-08-02 17:12:532024-08-02 17:12:54

Judging History

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

  • [2024-08-02 17:12:54]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:6456kb
  • [2024-08-02 17:12:53]
  • 提交

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};
int dp[1005][1005];
string s[1005];
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
    {
        int xx=x+1;
        int yy=y;
        if(xx<=n&&yy<=m)
        {
            dfs(xx,yy,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.141592653589;
    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: 2ms
memory: 5064kb

input:

3 5
XOOXO
OXOXO
XXXXO

output:

71.4159265359

result:

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

Test #2:

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

input:

1 4
XOOX

output:

45.7079632679

result:

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

Test #3:

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

input:

1 1
X

output:

20.0000000000

result:

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

Test #4:

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

input:

1 1
O

output:

17.8539816340

result:

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

Test #5:

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

input:

1 3
XOO

output:

35.7079632679

result:

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

Test #6:

score: -100
Wrong Answer
time: 0ms
memory: 6456kb

input:

1 5
OXOOO

output:

57.8539816340

result:

wrong answer 1st numbers differ - expected: '55.7079633', found: '57.8539816', error = '0.0385226'