QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#766290#692. Delete the Pointspan_gWA 0ms3984kbC++202.7kb2024-11-20 16:51:572024-11-20 16:51:57

Judging History

This is the latest submission verdict.

  • [2024-11-20 16:51:57]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3984kb
  • [2024-11-20 16:51:57]
  • Submitted

answer

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

signed main(){
    std::cin.tie(nullptr) -> sync_with_stdio(false);
    int n;
    std::cin >> n;
    std::cout << "Yes" << endl;
    std::map<int, std::vector<int> > mp;
    for(int i = 0, x, y;i < n;i++){
        std::cin >> x >> y;
        mp[x].emplace_back(y);
    }

    std::cout << std::fixed << std::setprecision(1);
    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);
                std::cout << y - 0.5 << ' ' << l - 0.5 << ' ' << x + 0.5 << ' ' << r + 0.5 << endl;
            }
            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);
                std::cout << y - 0.5 << ' ' << l - 0.5 << ' ' << x + 0.5 << ' ' << r + 0.5 << endl;
            }

            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);
                    std::cout << x - len << ' ' << ty - len << ' ' << x << ' ' << ty << endl;
                    tx = ty = -1;
                    i ++;
                }
                else{
                    if(delx > dely){
                        int l = f[i], r = f[i + 1];
                        int y = x - (r - l);
                        std::cout << y << ' ' << l << ' ' << x << ' ' << r << endl;
                        i += 2;
                    }
                    else{
                        int len = x - tx; 
                        std::cout << x - len << ' ' << ty - len + 0.5 << ' ' << x << ' ' << ty + 0.5 << endl;
                        tx = ty = -1;
                        i ++;
                    }
                }
            }
            if(tx >= 0 && i < m){
                int len = std::max(x - tx, f[i] - ty);
                std::cout << x - len << ' ' << f[i] - len << ' ' << x << ' ' << f[i] << endl;
                tx = ty = -1;
                i ++;
            }

            for(;i + 1 < m;i += 2){
                lb l = f[i], r = f[i + 1];
                lb y = x - (r - l);
                std::cout << y - 0.5 << ' ' << l - 0.5 << ' ' << x + 0.5 << ' ' << r + 0.5 << endl;
            }
            if(i == m - 1) tx = x, ty = f.back();
        }
    }

    return 0;
}

详细

Test #1:

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

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

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

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

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

input:

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

output:

Yes
-3.5 30.5 2.5 36.5
-56 17 23 96
-58 0 30 88
39 52 59 72
8 23 61 76

result:

ok OK

Test #6:

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

input:

10
53 95
37 51
84 11
3 39
31 20
37 84
42 27
95 38
6 6
16 19

output:

Yes
-27 6 6 39
16 5 31 20
3.5 50.5 37.5 84.5
-15 27 53 95
68 11 95 38

result:

ok OK

Test #7:

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

input:

3000
997371332 135791687
997371332 135791686
997371332 135791685
997371333 135791685
997371333 135791687
997371334 135791687
997371333 135791688
997371331 135791686
997371333 135791689
997371334 135791686
997371334 135791689
997371333 135791684
997371332 135791689
997371331 135791685
997371334 13579...

output:

Yes
997371302.5 135791683.5 997371304.5 135791685.5
997371303 135791708.5 997371304 135791709.5
997371303.5 135791684.5 997371305.5 135791686.5
997371300.5 135791693.5 997371305.5 135791698.5
997371303.5 135791706.5 997371305.5 135791708.5
997371304 135791708 997371305 135791709
997371304.5 13579168...

result:

wrong answer We have 3 point(s) in query 4