QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#296751#692. Delete the PointsgubshigWA 961ms167088kbC++171.0kb2024-01-03 15:18:142024-01-03 15:18:15

Judging History

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

  • [2024-01-03 15:18:15]
  • 评测
  • 测评结果:WA
  • 用时:961ms
  • 内存:167088kb
  • [2024-01-03 15:18:14]
  • 提交

answer

#include <bits/stdc++.h>
#define x first
#define y second
#define all(v) v.begin(), v.end()
using namespace std;
using pii = pair<int, int>;

int n;
bool vis[3030];
pii p[3030];

int main(){
    cin.tie(nullptr)->sync_with_stdio(0);
    
    cin >> n;
    for(int i = 1; i <= n; i++) cin >> p[i].x >> p[i].y;

    vector<array<int, 5>> v;
    for(int i = 1; i <= n; i++) for(int j = i + 1; j <= n; j++){
        int x2 = max(p[i].x, p[j].x), y2 = max(p[i].y, p[j].y);
        int w = max(max(x2 - p[i].x, y2 - p[i].y), max(x2 - p[j].x, y2 - p[j].y));
        v.push_back({w, x2, y2, i, j});
    }
    sort(all(v));

    vector<array<int, 4>> ans;
    for(auto &[w, x2, y2, i, j] : v){
        if(vis[i] || vis[j]) continue;

        int x1 = x2 - w, y1 = y2 - w;

        vis[i] = 1;
        vis[j] = 1;
        ans.push_back({x1, y1, x2, y2});
    }

    cout << "Yes\n";
    for(auto &[x1, y1, x2, y2] : ans){
        cout << x1 << ' ' << y1 << ' ' << x2 << ' ' << y2 << '\n';
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3492kb

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

input:

4
0 0
1 2
2 1
4 4

output:

Yes
1 1 2 2
0 0 4 4

result:

ok OK

Test #3:

score: 0
Accepted
time: 1ms
memory: 3496kb

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: 1ms
memory: 3452kb

input:

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

output:

Yes
5 9 10 14
10 4 15 9
1 -5 20 14

result:

ok OK

Test #5:

score: 0
Accepted
time: 1ms
memory: 3444kb

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 31 2 36
23 72 39 88
13 0 30 17
35 52 59 76
-12 23 61 96

result:

ok OK

Test #6:

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

input:

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

output:

Yes
31 16 42 27
3 6 16 19
37 79 53 95
68 11 95 38
3 17 37 51

result:

ok OK

Test #7:

score: -100
Wrong Answer
time: 961ms
memory: 167088kb

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 135791684 997371304 135791685
997371303 135791708 997371304 135791709
997371304 135791685 997371305 135791686
997371304 135791707 997371305 135791708
997371304 135791709 997371305 135791710
997371305 135791684 997371306 135791685
997371305 135791693 997371306 135791694
997371305 135791...

result:

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