QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#313904 | #7730. Convex Checker | Hqwq | Compile Error | / | / | C++14 | 1.6kb | 2024-01-25 09:56:31 | 2024-01-25 09:56:32 |
Judging History
你现在查看的是最新测评结果
- [2024-07-04 19:27:17]
- hack成功,自动添加数据
- (/hack/727)
- [2024-07-04 19:17:30]
- hack成功,自动添加数据
- (/hack/726)
- [2024-01-25 09:56:32]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-01-25 09:56:31]
- 提交
answer
#include<bits/stdc++.h>
using namespace std;
int n,cnt=0;
struct point{
int x,y;
}p[200010],v[200010],q[200010];
bool cmp(point x,point y){
if (x.x!=y.x) return x.x<y.x;
return x.y<y.y;
}
bool check(point x,point y,point z){
int a,b,c,d;
a=y.x-x.x;
b=y.y-x.y;
c=z.x-x.x;
d=z.y-x.y;
if (a*d-b*c>0) return 1;
return 0;
}
void tb(){
v[++cnt]=p[1];
v[++cnt]=p[2];
for (int i=3;i<=n;i++){
while(!check(v[cnt-1],v[cnt],p[i]) && cnt>1){
cnt--;
}
v[++cnt]=p[i];
}
int temp=cnt;
v[++cnt]=p[n-1];
for (int i=n-2;i>=1;i--){
while(!check(v[cnt-1],v[cnt],p[i]) && cnt>temp){
cnt--;
}
v[++cnt]=p[i];
}
cnt--;
}
int main(){
scanf("%d",&n);
for (int i=1;i<=n;i++){
int x,y;
scanf("%d %d",&p[i].x,&p[i].y);
q[i]=p[i];
}
//sort(p+1,p+1+n,cmp);
tb();
int pp=1;
if (cnt!=n) pp=0;
// else {
// int p1=1,p2=1;
// int i=1,j;
// for (i=1;i<=n;i++) if (q[1].x==v[i].x && q[1].y==v[i].y) break;
// j=1;
// while(j<=n){
// if (v[i].x!=q[j].x || v[i].y!=q[j].y){
// p1=0;
// break;
// }
// i=i%n+1;
// j=j+1;
// }
// for (i=1;i<=n;i++) if (q[1].x==v[i].x && q[1].y==v[i].y) break;
// j=1;
// while(j<=n){
// if (v[i].x!=q[j].x || v[i].y!=q[j].y){
// p2=0;
// break;
// }
// i=i-1;
// if (i<=0) i+=n;
// j=j+1;
// }
// pp=p1|p2;
}
if (pp) printf("Yes\n");
else printf("No\n");
}
详细
answer.code:81:5: error: expected unqualified-id before ‘if’ 81 | if (pp) printf("Yes\n"); | ^~ answer.code:82:5: error: expected unqualified-id before ‘else’ 82 | else printf("No\n"); | ^~~~ answer.code:83:1: error: expected declaration before ‘}’ token 83 | } | ^ answer.code: In function ‘int main()’: answer.code:45:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 45 | scanf("%d",&n); | ~~~~~^~~~~~~~~ answer.code:48:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 48 | scanf("%d %d",&p[i].x,&p[i].y); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~