QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#501312 | #5153. Delft Distance | 1DemonS1 | WA | 1ms | 3928kb | C++20 | 1.5kb | 2024-08-02 16:38:11 | 2024-08-02 16:38:12 |
Judging History
answer
#include<bits/stdc++.h>
//#define int long long
#define endl "\n"
#define ll long long
#define PII std::pair<int,int>
#define pi acos(-1)
using namespace std;
const int maxn = 705;
const int mod = 998244353;
int dp[maxn][maxn];
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(0);
cout << fixed << setprecision(10);
int N, M;
cin >> N >> M;
vector<vector<char>> G(N + 2, vector<char>(M + 2));
for (int i = 1; i <= N; ++i) {
for (int j = 1; j <= M; ++j) {
cin >> G[i][j];
}
}
for (int i = 1; i <= N + 1; ++i) {
for (int j = 1; j <= M + 1; ++j) {
if(i - 1 > 0) dp[i][j] = max(dp[i][j], dp[i - 1][j]);
if(j - 1 > 0) dp[i][j] = max(dp[i][j], dp[i][j - 1]);
if (i - 1 > 0 && j - 1 > 0) {
if (i - 1 >= 1 && j - 1 >= 1 && G[i - 1][j - 1] == 'O' && G[i - 1][j] == 'O')
dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + 2);
else if (i - 1 >= 1 && j - 1 >= 1 && G[i - 1][j - 1] == 'O' && G[i][j - 1] == 'O')
dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + 2);
else if(i - 1 >= 1 && j - 1 >= 1 && G[i - 1][j - 1] == 'O')
dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + 1);
}
}
}
double cnt = 10 - 2 * pi * 5 / 4;
//cout << cnt << endl;
//cout << dp[N + 1][M + 1] << endl;
cout << (N + M) * 1.0 * 10 - dp[N + 1][M + 1] * cnt << endl;
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3812kb
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: 3808kb
input:
1 4 XOOX
output:
45.7079632679
result:
ok found '45.7079633', expected '45.7079633', error '0.0000000'
Test #3:
score: 0
Accepted
time: 1ms
memory: 3780kb
input:
1 1 X
output:
20.0000000000
result:
ok found '20.0000000', expected '20.0000000', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3784kb
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: 3816kb
input:
1 3 XOO
output:
35.7079632679
result:
ok found '35.7079633', expected '35.7079633', error '0.0000000'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3784kb
input:
1 5 OXOOO
output:
55.7079632679
result:
ok found '55.7079633', expected '55.7079633', error '0.0000000'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3736kb
input:
6 10 XXXXXOOOOX XXOOOOOOOO XXXOXOOXOX OXOXOXXOOX OOXXOXXXXO OXOXXOOXOO
output:
142.8318530718
result:
ok found '142.8318531', expected '142.8318531', error '0.0000000'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3856kb
input:
1 2 XX
output:
30.0000000000
result:
ok found '30.0000000', expected '30.0000000', error '0.0000000'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3900kb
input:
10 1 X X X O O O X O O X
output:
105.7079632679
result:
ok found '105.7079633', expected '105.7079633', error '0.0000000'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3928kb
input:
18 6 OOOOOO OOOOOO XOOOOO OOOOXO OOOXOO OOOOOO OOOOOO OOOOOO OOOOOX OOOOOO OOOXOO OOOOOO OOOOOO OOOOOO OOOOOO OOOOOO OOOOOO OOOOOO
output:
214.2477796077
result:
ok found '214.2477796', expected '214.2477796', error '0.0000000'
Test #11:
score: -100
Wrong Answer
time: 1ms
memory: 3840kb
input:
40 9 OOOOXOXXX XOXXXOXXO OXOXXXXXO OXOXXXOXX XXXXOXOXX XXOOXOXXX XOOXOXXXX XOXXOOXOX OXXOOOOXX XXOOOXXOO OXOOXOXXX OOOOOXOOO OXXXXXXXO OOOOOOOXX OOOXXXOOX OXOXXOOOO OOOOXOXOO OXOXOOOXO OXXOOXXXO OXOOXOOXO XXXOXOXOO XXOOOXOOX OOXXOOXOO XOOXXXXOX OXXXXOOOO OXOOOOXOX XXOXXXOOO OOXOOOXXX OXOOOOXOO OXOOO...
output:
451.3716694115
result:
wrong answer 1st numbers differ - expected: '453.5176878', found: '451.3716694', error = '0.0047319'