QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#536092#4569. Connect the PointsLavine#WA 0ms3888kbC++141004b2024-08-28 18:28:542024-08-28 18:28:55

Judging History

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

  • [2024-08-28 18:28:55]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3888kb
  • [2024-08-28 18:28:54]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
long long x[5],y[5];
struct L{
    int x1,x2,y1,y2;
};
vector<L>ans;
void Link(int x1,int y1,int x2,int y2){
    if(x1==x2&&y1==y2)return;
    ans.push_back((L){x1,x2,y1,y2});
}
int main(){
    scanf("%lld %lld %lld %lld %lld %lld",&x[1],&y[1],&x[2],&y[2],&x[3],&y[3]);
    if(x[1]>x[2])swap(x[1],x[2]),swap(y[1],y[2]);
    if(x[1]>x[3])swap(x[1],x[3]),swap(y[1],y[3]);
    if(x[2]>x[3])swap(x[2],x[3]),swap(y[2],y[3]);
    if(y[2]>y[1]&&y[2]>y[3]){
        Link(x[1],y[1],x[2],y[1]),Link(x[3],y[3],x[2],y[3]);
        Link(x[2],y[2],x[2],min(y[1],y[2]));
    }else if(y[2]<y[1]&&y[2]<y[3]){
        Link(x[1],y[1],x[2],y[1]),Link(x[3],y[3],x[2],y[3]);
        Link(x[2],y[2],x[2],max(y[1],y[2]));
    }else {
        Link(x[1],y[1],x[2],y[1]),Link(x[3],y[3],x[2],y[3]);
        Link(x[2],y[1],x[2],y[3]);
    }
    printf("%d\n",(int)ans.size());
    for(auto t:ans){
        printf("%d %d %d %d\n",t.x1,t.y1,t.x2,t.y2);
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1 1
3 5
8 6

output:

3
1 1 3 1
8 6 3 6
3 1 3 6

result:

ok Total length is 12

Test #2:

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

input:

1 1
2 2
3 3

output:

3
1 1 2 1
3 3 2 3
2 1 2 3

result:

ok Total length is 4

Test #3:

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

input:

1 1
2 3
3 2

output:

3
1 1 2 1
3 2 2 2
2 3 2 1

result:

ok Total length is 4

Test #4:

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

input:

1 2
2 1
3 3

output:

3
1 2 2 2
3 3 2 3
2 1 2 2

result:

wrong answer Points #1 and #2 are not connected