QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#746761 | #8775. MountainCraft | cyj888 | WA | 0ms | 3956kb | C++14 | 1.6kb | 2024-11-14 15:28:53 | 2024-11-14 15:28:53 |
Judging History
answer
#include <bits/stdc++.h>
//#define int long long
#define fi first
#define se second
#define pb push_back
#define ott(i, l, r) for (register int i = (l); i <= (r); i ++)
#define tto(i, l, r) for (register int i = (r); i >= (l); i --)
using namespace std;
typedef long long ll;
typedef long double ld;
int read () {
int x = 0; bool f = false; char c = getchar ();
while (!isdigit (c)) f |= (c == '-'), c = getchar ();
while (isdigit (c)) x = (x << 3) + (x << 1) + (c ^ 48), c = getchar ();
return f ? -x : x;
}
const int N = 2e5 + 110, mod = 1e9 + 7;
int n, m, q, w, res;
pair <int, int> p[N];
map <int, map <int, bool> > del;
int main () {
q = read (), w = read ();
ott (j, 1, q) {
register int x = read (), y = read ();
bool ok = true, ko = false; ott (i, 1, n) {
if (p[i].fi <= x && p[i].fi + p[i].se >= x + y) ok = false;
if (p[i].fi >= x && p[i].fi - p[i].se <= x - y) ok = false;
if (p[i].fi == x && p[i].se == y && del[x][y]) ko = true;
}
del[x][y] ^= 1;
if (ko) {
m = 0;
ott (i, 1, n) if (p[i].fi ^ x || p[i].se ^ y) p[++ m] = p[i];
n = m;
}
else if (ok) {
m = 0; ott (i, 1, n) {
if (p[i].fi < x && p[i].fi - p[i].se <= x - y) p[++ m] = p[i];
if (p[i].fi > x && p[i].fi + p[i].se >= x + y) {
if (p[m].fi < x) p[++ m] = {x, y};
p[++ m] = p[i];
}
}
if (p[m].fi < x) p[++ m] = {x, y};
n = m;
}
if (n) res = min (p[1].fi, p[1].se) + min (w - p[n].fi, p[n].se) + p[n].fi - p[1].fi;
else res = 0;
printf ("%.6lf\n", 1.0 * res * pow (2, 0.5));
// printf ("i = %d\n", j); ott (i, 1, n) printf ("[%d, %d]\n", p[i].fi, p[i].se);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3920kb
input:
3 10 3 2 7 3 9 6
output:
5.656854 12.727922 12.727922
result:
ok 3 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 3956kb
input:
5 100 31 41 59 26 31 41 59 26 31 41
output:
101.823376 120.208153 73.539105 0.000000 101.823376
result:
ok 5 numbers
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3892kb
input:
100 10 6 4 2 3 7 6 5 5 3 6 7 5 5 8 10 4 9 8 0 9 9 10 9 3 2 3 10 10 8 4 10 9 0 1 1 7 0 2 3 4 10 3 3 10 7 4 7 5 1 4 0 7 1 9 5 6 8 8 7 4 8 1 3 9 2 1 5 5 2 1 10 9 8 4 0 9 10 7 4 1 9 10 8 6 5 4 1 4 0 9 9 3 4 8 5 10 7 2 8 10 7 10 3 4 2 2 8 5 0 9 5 3 1 4 6 4 0 3 8 1 1 6 3 8 8 4 6 5 10 2 2 2 8 4 6 1 2 4 6 4...
output:
11.313708 7.071068 14.142136 14.142136 14.142136 14.142136 14.142136 14.142136 14.142136 14.142136 14.142136 14.142136 14.142136 14.142136 14.142136 14.142136 14.142136 14.142136 14.142136 14.142136 14.142136 14.142136 14.142136 14.142136 14.142136 14.142136 14.142136 14.142136 14.142136 14.142136 1...
result:
wrong answer 2nd numbers differ - expected: '14.1421356', found: '7.0710680', error = '0.5000000'