QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#533760#8775. MountainCrafthank0402WA 0ms3888kbC++14983b2024-08-26 13:09:252024-08-26 13:09:25

Judging History

你现在查看的是最新测评结果

  • [2024-08-26 13:09:25]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3888kb
  • [2024-08-26 13:09:25]
  • 提交

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'