QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#501513 | #5153. Delft Distance | Railgun2334 | RE | 0ms | 0kb | C++20 | 1.7kb | 2024-08-02 19:52:35 | 2024-08-02 19:52:36 |
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+1,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: 0
Runtime Error
input:
3 5 XOOXO OXOXO XXXXO