QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#533760 | #8775. MountainCraft | hank0402 | WA | 0ms | 3888kb | C++14 | 983b | 2024-08-26 13:09:25 | 2024-08-26 13:09:25 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 10;
int tot, q, w, rt;
struct node { // 动态开点
int lc, rc, sum, tag;
} t[N << 4];
void pushup(int x, int l, int r) {
if(t[x].tag) {
t[x].sum = r - l + 1;
} else {
t[x].sum = t[t[x].lc].sum + t[t[x].rc].sum;
}
}
void modify(int &x, int l, int r, int L, int R, int v) {
if(!x) x = ++tot;
if(L <= l && r <= R) {
t[x].tag += v;
return pushup(x, l, r);
}
int mid = (l + r) / 2;
if(L <= mid) modify(t[x].lc, l, mid, L, R, v);
if(mid + 1 <= R) modify(t[x].rc, mid + 1, r, L, R, v);
pushup(x, l, r);
}
map<pair<int, int>, int> mp;
int main() {
cin >> q >> w;
while(q --) {
int x, y; cin >> x >> y;
int f = (mp[{x, y}] == 1) ? (-1) : 1;
modify(rt, 0, w, max(x - y, 0), min(x + y, w) - 1, f);
printf("%.6lf\n", (double)t[rt].sum * (double)sqrt(2));
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3888kb
input:
3 10 3 2 7 3 9 6
output:
5.656854 12.727922 12.727922
result:
ok 3 numbers
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3884kb
input:
5 100 31 41 59 26 31 41 59 26 31 41
output:
101.823376 120.208153 120.208153 120.208153 120.208153
result:
wrong answer 3rd numbers differ - expected: '73.5391050', found: '120.2081530', error = '0.6346154'