QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#536092 | #4569. Connect the Points | Lavine# | WA | 0ms | 3888kb | C++14 | 1004b | 2024-08-28 18:28:54 | 2024-08-28 18:28:55 |
Judging History
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);
}
}
详细
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