QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#740894#8775. MountainCraftactorWA 1ms4032kbC++141.6kb2024-11-13 12:09:532024-11-13 12:09:55

Judging History

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

  • [2024-11-13 12:09:55]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4032kb
  • [2024-11-13 12:09:53]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define rep(i,l,r) for (int i = (l); i <= (r); i++)
#define per(i,r,l) for (int i = (r); i >= (l); i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define maxn(a, b) a = max(a, b)
#define minn(a, b) a = min(a, b)
typedef vector<int> VI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
const ll mod = 998244353;
mt19937 gen(random_device{}());
ll rp(ll a,ll b) {ll res=1%mod;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}

int main() {
    int q, w;
    scanf("%d%d", &q, &w);
    set<PII> st;
    multiset<int> X, Y;
    while (q--) {
        int x, y;
        scanf("%d%d", &x, &y);
        if (st.count(mp(x, y))) {
            X.erase(X.find(y - x));
            Y.erase(Y.find(y + x));
            st.erase(mp(x, y));
        } else {
            X.insert(y - x);
            Y.insert(y + x);
            st.insert(mp(x, y));
        }

        db ans = 0;
        if (!st.empty()) {
            int mx = *X.rbegin();
            int my = *Y.rbegin();
            // (y - x = mx && y + x == my)
            db xx = (my - mx) / 2.0;
            db yy = (my + mx) / 2.0;
            // printf("%d %d %d %d\n", x, y, mx, my);
            ans += sqrtl(min(xx, yy) * 1ll * min(xx, yy) * 2);
            ans += sqrtl(min(yy, w - xx) * 1ll * min(yy, w - xx) * 2);
        }
        printf("%.6lf\n", ans);
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 3796kb

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: 0
Accepted
time: 0ms
memory: 3800kb

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
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
14.142136
...

result:

ok 100 numbers

Test #4:

score: -100
Wrong Answer
time: 1ms
memory: 4032kb

input:

1000 100
95 8
54 8
64 96
47 34
77 47
99 91
45 70
8 6
64 84
48 42
53 14
73 66
38 27
6 52
19 75
33 39
6 24
37 80
27 45
96 48
55 95
67 1
23 78
40 4
76 7
77 22
4 47
41 31
60 54
96 37
79 52
63 40
7 92
17 7
74 12
93 16
87 5
67 43
60 29
71 58
52 41
53 84
38 2
46 87
13 54
54 14
16 93
57 7
91 98
31 23
70 3
9...

output:

18.384776
76.367532
141.421356
141.421356
141.421356
141.421356
141.421356
141.421356
141.421356
141.421356
141.421356
141.421356
141.421356
141.421356
141.421356
141.421356
141.421356
141.421356
141.421356
141.421356
141.421356
141.421356
141.421356
141.421356
141.421356
141.421356
141.421356
141.4...

result:

wrong answer 2nd numbers differ - expected: '41.0121933', found: '76.3675320', error = '0.8620690'