QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#201812 | #5153. Delft Distance | Orange_JuiCE# | WA | 0ms | 3940kb | C++17 | 1.9kb | 2023-10-05 16:52:30 | 2023-10-05 16:52:31 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr)
#define rep(a, b, c) for(int (a)=(b);(a)<=(c);(a)++)
#define per(a, b, c) for(int (a)=(b);(a)>=(c);(a)--)
#define mset(var, val) memset(var,val,sizeof(var))
#define ll long long
#define fi first
#define se second
#define no "No\n"
#define yes "Yes\n"
#define pb push_back
#define endl "\n"
#define pii pair<int,int>
#define pll pair<ll,ll>
#define dbg(x...) do{cout<<#x<<" -> ";err(x);}while (0)
void err() { cout << '\n'; }
template<class T, class... Ts>
void err(T arg, Ts... args) {
cout << arg << ' ';
err(args...);
}
const double inf = 5000.0;
const double one = 2.5*acos(-1.0);
int n, m;
double a[1500][1500];
string s[705];
void solve() {
cin >> n >> m;
for(int i = 0; i < n; i++) {
cin >> s[i];
}
for(int i = 0; i < n*2+2; i++) {
for(int j = 0; j < m*2+2; j++) {
a[i][j] = inf;
}
}
a[0][0] = 0;
for(int i = 0; i <= 2*n; i++) {
for(int j = 0; j <= 2*m; j++) {
if(((i&1) && (j&1)) || (a[i][j] == inf)) continue;
if((i&1) || (j&1)) {
if(s[i/2][j/2] == 'O') {
a[i+1][j+1] = min(a[i+1][j+1], a[i][j] + one);
}
else if(i&1){
a[i+1][j] = min(a[i+1][j], a[i][j] + 5);
}
else {
a[i][j+1] = min(a[i][j+1], a[i][j] + 5);
}
}
else {
a[i+1][j] = min(a[i+1][j], a[i][j] + 5);
a[i][j+1] = min(a[i][j+1], a[i][j] + 5);
}
}
}
printf("%.10lf\n", a[2*n][2*m]);
}
int main() {
IOS;
int T = 1;
// cin >> T;
while (T--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3916kb
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: 3940kb
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: 3888kb
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: 3900kb
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: 3940kb
input:
1 3 XOO
output:
35.7079632679
result:
ok found '35.7079633', expected '35.7079633', error '0.0000000'
Test #6:
score: -100
Wrong Answer
time: 0ms
memory: 3940kb
input:
1 5 OXOOO
output:
57.8539816340
result:
wrong answer 1st numbers differ - expected: '55.7079633', found: '57.8539816', error = '0.0385226'