QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#501297 | #5153. Delft Distance | 1DemonS1 | WA | 0ms | 3812kb | C++20 | 1.3kb | 2024-08-02 16:27:54 | 2024-08-02 16:27:58 |
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')
dp[i][j] = max(dp[i][j], dp[i - 1][j - 1] + 1);
}
}
}
double cnt = 10 - 2 * pi * 5 / 4;
cout << (N + M) * 1.0 * 10 - dp[N + 1][M + 1] * cnt << endl;
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3784kb
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: 3724kb
input:
1 4 XOOX
output:
45.7079632679
result:
ok found '45.7079633', expected '45.7079633', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3796kb
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: 3788kb
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: 3788kb
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: 3776kb
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: 3744kb
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: 3784kb
input:
1 2 XX
output:
30.0000000000
result:
ok found '30.0000000', expected '30.0000000', error '0.0000000'
Test #9:
score: -100
Wrong Answer
time: 0ms
memory: 3812kb
input:
10 1 X X X O O O X O O X
output:
107.8539816340
result:
wrong answer 1st numbers differ - expected: '105.7079633', found: '107.8539816', error = '0.0203014'