QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#501481 | #5153. Delft Distance | pagohia | WA | 0ms | 3908kb | C++14 | 2.0kb | 2024-08-02 19:22:05 | 2024-08-02 19:22:11 |
Judging History
answer
#include<bits/stdc++.h>
#include <unordered_map>
using namespace std;
#define MAXN ((int) 2e5)
const int N = 2890;
const int M = 5e4 + 10;
typedef long long ll;
typedef double db;
typedef pair<int, int>pii;
typedef pair<long, long>pll;
int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };
const int mod = 1e9 + 7;
inline long long read()
{
long long w = 1;
long long q = 0;
char ch = ' ';
while (ch != '-' && (ch < '0' || ch>'9')) ch = getchar();
if (ch == '-') w = -1, ch = getchar();
while (ch >= '0' && ch <= '9')
q = q * 10 + ch - '0', ch = getchar();
return w * q;
}
const long double pr = 7.853981633975;
int n, m;
int s[N][N];
long double ans = 100000.0;
void dfs(int x, int y, int ban, int quan)
{
if (x > 2 * n+1 || y > 2 * m+1) return;
if (x == 2 * n+1 and y == 2 * m+1)
{
ans = min(ans, ban * 5.0 + quan * pr) ;
return;
}
if (s[x][y] == 1)
{
dfs(x + 1, y, ban + 1, quan);
dfs(x, y + 1, ban + 1, quan);
}
else if (s[x][y] == 2)
{
dfs(x + 1, y + 1, ban, quan + 1);
dfs(x, y + 1, ban + 1, quan);
}
else if (s[x][y] == -2)
{
dfs(x + 1, y + 1, ban, quan + 1);
dfs(x + 1, y, ban + 1, quan);
}
else if (s[x][y] == -1)
{
dfs(x + 1, y, ban + 1, quan);
dfs(x, y + 1, ban + 1, quan);
}
else if (s[x][y] == 0)
{
dfs(x + 1, y, ban + 1, quan);
dfs(x, y + 1, ban + 1, quan);
}
}
void sovle()
{
cin >>n >> m;
for (int i = 1; i <= 2*n; i+=2)
{
for (int j = 1; j <=2* m; j+=2)
{
char ch;
cin >> ch;
if (ch == 'X')
{
s[i][j] = 1;
s[i + 1][j] =1;
s[i][j + 1] = 1;
s[i + 1][j + 1] = 1;
}
else
{
s[i][j] = -1;
s[i + 1][j] = -2;
s[i][j + 1] = 2;
s[i + 1][j + 1] = -11;
}
}
}
dfs(1, 1,0,0);
printf(" % .10lf\n", ans);
/*for (int i = 1; i <= 2 * n; i++)
{
for (int j = 1; j <= 2 * m; j++)
cout << s[i][j] << "\t";
cout << endl;
}*/
}
int main()
{
int tcase= 1;
//cin>>tcase;
while (tcase--)
{
sovle();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3908kb
input:
3 5 XOOXO OXOXO XXXXO
output:
0.0000000000
result:
wrong answer 1st numbers differ - expected: '71.4159265', found: '0.0000000', error = '1.0000000'