QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#536098 | #4569. Connect the Points | Lavine# | Compile Error | / | / | C++14 | 2.0kb | 2024-08-28 18:33:03 | 2024-08-28 18:33:06 |
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[3]));
}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[3]));
}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);
}
}#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[3]));
}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[3]));
}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);
}
}
详细
answer.code:31:2: error: stray ‘#’ in program 31 | }#include<bits/stdc++.h> | ^ answer.code:31:3: error: ‘include’ does not name a type 31 | }#include<bits/stdc++.h> | ^~~~~~~ answer.code:33:11: error: redefinition of ‘long long int x [5]’ 33 | long long x[5],y[5]; | ^ answer.code:3:11: note: ‘long long int x [5]’ previously declared here 3 | long long x[5],y[5]; | ^ answer.code:33:16: error: redefinition of ‘long long int y [5]’ 33 | long long x[5],y[5]; | ^ answer.code:3:16: note: ‘long long int y [5]’ previously declared here 3 | long long x[5],y[5]; | ^ answer.code:34:8: error: redefinition of ‘struct L’ 34 | struct L{ | ^ answer.code:4:8: note: previous definition of ‘struct L’ 4 | struct L{ | ^ answer.code:37:10: error: redefinition of ‘std::vector<L> ans’ 37 | vector<L>ans; | ^~~ answer.code:7:10: note: ‘std::vector<L> ans’ previously declared here 7 | vector<L>ans; | ^~~ answer.code:38:6: error: redefinition of ‘void Link(int, int, int, int)’ 38 | void Link(int x1,int y1,int x2,int y2){ | ^~~~ answer.code:8:6: note: ‘void Link(int, int, int, int)’ previously defined here 8 | void Link(int x1,int y1,int x2,int y2){ | ^~~~ answer.code:42:5: error: redefinition of ‘int main()’ 42 | int main(){ | ^~~~ answer.code:12:5: note: ‘int main()’ previously defined here 12 | int main(){ | ^~~~ answer.code: In function ‘int main()’: answer.code:13:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%lld %lld %lld %lld %lld %lld",&x[1],&y[1],&x[2],&y[2],&x[3],&y[3]); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ answer.code: In function ‘int main()’: answer.code:43:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 43 | scanf("%lld %lld %lld %lld %lld %lld",&x[1],&y[1],&x[2],&y[2],&x[3],&y[3]); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~