QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#766128#692. Delete the Pointspan_gWA 0ms4032kbC++202.1kb2024-11-20 16:19:172024-11-20 16:19:17

Judging History

This is the latest submission verdict.

  • [2024-11-20 16:19:17]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 4032kb
  • [2024-11-20 16:19:17]
  • 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(3);
    lb tx = -1, ty = -1;
    
    auto delete_with_t = [&](lb x, lb y) -> void {
        lb len = std::max(std::fabs(x - tx), std::fabs(y - ty));
        lb r = std::max(ty, y);
        std::cout << x - len << ' ' << r - len << ' ' << x << ' ' << r << endl;
        tx = ty = -1;
    };

    auto delete_pair = [&](lb x, lb sy, lb by) -> void {
        lb y = x - (by - sy);
        std::cout << y << ' ' << sy << ' ' << x + 0.5 << ' ' << by + 0.5 << endl;
    };
    
    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) delete_pair(x, f[i], f[i + 1]);
            if(m & 1) tx = x, ty = f.back();
        }
        else{
            for(;i + 1 < m && f[i + 1] < ty;i += 2) delete_pair(x, f[i], f[i + 1]);

            if(i < m && f[i] <= ty){
                lb delx = (lb)x - tx;
                lb dely = ty - f[i];
                if(i == m - 1 || f[i + 1] > ty){
                    delete_with_t(x, f[i]);
                    i ++;
                }
                else{
                    if(delx > dely){
                        delete_pair(x, f[i], f[i + 1]);
                        i += 2;
                    }
                    else{
                        delete_with_t(x, f[i]);
                        i ++;
                    }
                }
            }
            if(tx >= 0 && i < m){
                delete_with_t(x, f[i]);
                i ++;
            }

            for(;i + 1 < m;i += 2) delete_pair(x, f[i], f[i + 1]);
            if(i == m - 1) tx = x, ty = f.back();
        }
    }

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
1 1
2 2
5 5
6 6

output:

Yes
1.000 1.000 2.000 2.000
5.000 5.000 6.000 6.000

result:

ok OK

Test #2:

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

input:

4
0 0
1 2
2 1
4 4

output:

Yes
-1.000 0.000 1.000 2.000
1.000 1.000 4.000 4.000

result:

ok OK

Test #3:

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

input:

4
1 2
3 2
2 1
2 3

output:

Yes
1.000 1.000 2.000 2.000
2.000 2.000 3.000 3.000

result:

ok OK

Test #4:

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

input:

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

output:

Yes
1.000 3.000 7.000 9.000
7.000 9.000 12.000 14.000
10.000 4.000 20.000 14.000

result:

ok OK

Test #5:

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

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.000 31.000 2.500 36.500
-56.000 17.000 23.000 96.000
-58.000 0.000 30.000 88.000
39.000 52.000 59.000 72.000
8.000 23.000 61.000 76.000

result:

ok OK

Test #6:

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

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.000 6.000 6.000 39.000
16.000 5.000 31.000 20.000
4.000 51.000 37.500 84.500
-15.000 27.000 53.000 95.000
68.000 11.000 95.000 38.000

result:

ok OK

Test #7:

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

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
997371303.000 135791684.000 997371304.500 135791685.500
997371303.000 135791708.000 997371304.000 135791709.000
997371304.000 135791685.000 997371305.500 135791686.500
997371301.000 135791694.000 997371305.500 135791698.500
997371304.000 135791707.000 997371305.500 135791708.500
997371304.000 13...

result:

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