QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#766353#692. Delete the Pointspan_gWA 0ms3932kbC++202.4kb2024-11-20 17:01:482024-11-20 17:01:48

Judging History

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

  • [2024-11-20 17:01:48]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3932kb
  • [2024-11-20 17:01:48]
  • 提交

answer

#include <bits/stdc++.h>
#define endl "\n"
typedef long long i64;
typedef double lb;

signed main(){
    int n;
    scanf("%d", &n);
    puts("Yes");
    std::map<int, std::vector<int> > mp;
    for(int i = 0, x, y;i < n;i++){
        scanf("%d%d", &x, &y);
        mp[x].emplace_back(y);
    }

    int tx = -1, ty = -1;
    for(auto &[x, f] : mp){
        sort(f.begin(), f.end());
        int i = 0, m = f.size();
        if(tx == -1){
            for(;i + 1 < m;i += 2){
                lb l = f[i], r = f[i + 1];
                lb y = x - (r - l);
                printf("%1lf %d %1lf %d %1lf\n", y + 0.5, l, x + 0.5, r);
            }
            if(i == m - 1) tx = x, ty = f.back();
        }
        else{
            for(;i + 1 < m && f[i + 1] < ty;i += 2){
                lb l = f[i], r = f[i + 1];
                lb y = x - (r - l);
                printf("%1lf %d %1lf %d %1lf\n", y + 0.5, l, x + 0.5, r);
            }

            if(i < m && f[i] <= ty){
                int delx = x - tx;
                int dely = ty - f[i];
                if(i == m - 1 || f[i + 1] > ty){
                    int len = std::max(delx, dely);
                    printf("%d %d %d %d\n", x - len, ty - len, x, ty);
                    tx = ty = -1;
                    i ++;
                }
                else{
                    if(delx > dely){
                        int l = f[i], r = f[i + 1];
                        int y = x - (r - l);
                        printf("%d %d %d %d\n", y, l, x, r);
                        i += 2;
                    }
                    else{
                        int len = x - tx; 
                        printf("%d %d %d %d\n", x - len, ty - len, x, ty);
                        tx = ty = -1;
                        i ++;
                    }
                }
            }
            if(tx >= 0 && i < m){
                int len = std::max(x - tx, f[i] - ty);
                printf("%d %d %d %d\n", x - len, f[i] - len, x, f[i]);
                tx = ty = -1;
                i ++;
            }

            for(;i + 1 < m;i += 2){
                lb l = f[i], r = f[i + 1];
                lb y = x - (r - l);
                printf("%1lf %d %1lf %d %1lf\n", y + 0.5, l, x + 0.5, r);
            }
            if(i == m - 1) tx = x, ty = f.back();
        }
    }

    return 0;
}

详细

Test #1:

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

input:

4
1 1
2 2
5 5
6 6

output:

Yes
1 1 2 2
5 5 6 6

result:

ok OK

Test #2:

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

input:

4
0 0
1 2
2 1
4 4

output:

Yes
-1 0 1 2
1 1 4 4

result:

ok OK

Test #3:

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

input:

4
1 2
3 2
2 1
2 3

output:

Yes
1 1 2 2
2 2 3 3

result:

ok OK

Test #4:

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

input:

6
12 9
1 5
10 14
20 14
15 4
7 9

output:

Yes
1 3 7 9
7 9 12 14
10 4 20 14

result:

ok OK

Test #5:

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

input:

10
39 72
59 52
23 17
2 31
30 0
25 88
2 36
61 23
4 96
59 76

output:

Yes
-2.500000 0 31.000000 -98601612 2.500000
-56 17 23 96
-58 0 30 88
39 52 59 72
8 23 61 76

result:

wrong answer More than 4 digits after decimal point!