QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#501357#5153. Delft DistanceRailgun2334RE 0ms0kbC++201.9kb2024-08-02 17:11:322024-08-02 17:11:34

Judging History

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

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

answer

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define re read()
#define MOD 998244353
#define i128 __int128
#define pll pair<ll,ll>
#define pii pair<int,int>
#define ull unsigned long long
#define INF 9223372036854775800
/*------------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[705][705];
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
    {
        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();
	}
}

詳細信息

Test #1:

score: 0
Runtime Error

input:

3 5
XOOXO
OXOXO
XXXXO

output:


result: