QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#501371 | #5153. Delft Distance | Railgun2334 | RE | 0ms | 4664kb | C++20 | 1.7kb | 2024-08-02 17:25:12 | 2024-08-02 17:25:13 |
Judging History
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();
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 4664kb
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: 4092kb
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: 3880kb
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