QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#518972#8775. MountainCraftsolar_express#WA 0ms3940kbC++141.6kb2024-08-14 14:54:392024-08-14 14:54:39

Judging History

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

  • [2024-08-14 14:54:39]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3940kb
  • [2024-08-14 14:54:39]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

set<pair<int, int> > S;
const int N = 2e5+5;
struct info {
    int lc, rc;
    int v, cnt, tag;
} a[N<<6];
int tot;

void gen(int &u, int l, int r) {
if (!u) {
        u = ++tot;
        a[u].cnt = r - l;
    }
}

int rt;
void ch(int &u, int l, int r, int s, int t, int v) {
    gen(u, l, r);
    if (l == s && r == t) {
        a[u].v += v;
        a[u].tag += v;
        return;
    }
    int mid = (l + r) >> 1;
    gen(a[u].lc, l, mid);
    gen(a[u].rc, mid, r);
    a[a[u].lc].v += a[u].tag;
    a[a[u].rc].v += a[u].tag;
    a[a[u].lc].tag += a[u].tag;
    a[a[u].rc].tag += a[u].tag;
    a[u].tag = 0;
    if (t <= mid) ch(a[u].lc, l, mid, s, t, v);
    else if (s >= mid) ch(a[u].rc, mid, r, s, t, v);
    else {
        ch(a[u].lc, l, mid, s, mid, v);
        ch(a[u].rc, mid, r, mid, t, v);
    }
    int lc = a[u].lc, rc = a[u].rc;
    a[u].v = min(a[lc].v, a[rc].v);
    a[u].cnt = 0;
    if (a[lc].v == a[u].v) a[u].cnt += a[lc].cnt;
    if (a[rc].v == a[u].v) a[u].cnt += a[rc].cnt;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n, R;
    cin >> n >> R;
    while (n--) {
        int x, y;
        cin >> x >> y;
        int l = max(0, x-y), r = min(R, x+y);
        if (S.find({x, y}) != end(S)) {
            ch(rt, 0, R, l, r, -1);
            S.erase({x, y});
        } else {
            ch(rt, 0, R, l, r, 1);
            S.insert({x, y});
        }
        cout << setprecision(20) << (R - a[rt].cnt) * sqrt(2) << '\n';
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3932kb

input:

3 10
3 2
7 3
9 6

output:

5.6568542494923805819
12.727922061357856975
12.727922061357856975

result:

ok 3 numbers

Test #2:

score: 0
Accepted
time: 0ms
memory: 3940kb

input:

5 100
31 41
59 26
31 41
59 26
31 41

output:

101.8233764908628558
120.20815280171308359
73.539105243400953782
0
101.8233764908628558

result:

ok 5 numbers

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3936kb

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.313708498984761164
4.2426406871192856585
12.727922061357856975
12.727922061357856975
11.313708498984761164
12.727922061357856975
12.727922061357856975
12.727922061357856975
12.727922061357856975
12.727922061357856975
12.727922061357856975
12.727922061357856975
12.727922061357856975
12.72792206135...

result:

wrong answer 2nd numbers differ - expected: '14.1421356', found: '4.2426407', error = '0.7000000'