QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#57479 | #692. Delete the Points | Qingyu | Compile Error | / | / | C++23 | 1.7kb | 2022-10-22 14:01:31 | 2022-10-22 14:01:33 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2022-10-22 14:01:33]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2022-10-22 14:01:31]
- 提交
answer
#include<bits/stdc++.h>
using namespace std;
const int N=3005;
int n,T;
inline int read(){
int x=0;
char c=getchar();
while(c<'0'||c>'9') c=getchar();
while(c>='0'&&c<='9')
x=(x<<3)+(x<<1)+(c^48), c=getchar();
return x;
}
struct Dot{
int x,y;
Dot(int _x=0,int _y=0){ x=_x, y=_y; }
}dot[N];
inline bool cmp(Dot a,Dot b){
if(a.x!=b.x) return a.x<b.x;
return a.y<b.y;
}
inline void Delete(int i){
int x=dot[i].x,y0=dot[i].y,y1=dot[i+1].y;
//cout<<x<<' '<<y0<<' '<<dot[i+1].x<<' '<<y1<<'\n';
printf("%.1lf %d %.1lf %d\n",x+0.5,y0,x-y1+y0+0.5,y1);
}
inline void Solve0(int l,int r,Dot &t){
for(register int i=l;i+1<=r;i+=2) Delete(i);
if((r-l+1)&1) t=dot[r];
}
inline void Solve(){
cout<<"Yes\n";
Dot t=Dot(-1,-1);
for(register int l=1,r=1;l<=n;l=r=r+1){
while(r<n&&dot[l].x==dot[r+1].x) ++r;
if(t.x==-1) Solve0(l,r,t);
else{
int p=l;
while(p<r&&dot[p+1].y<t.y) Delete(p), p+=2;
if(p<=r&&dot[p].y<=t.y){
int x0=t.x,x1=dot[p].x,y0=dot[p].y,y1=t.y;
if(p==r||dot[p+1].y>t.y){
int mx=max(x1-x0,y1-y0); ++p, t=Dot(-1,-1);
printf("%d %d %d %d\n",x1-mx,y1-mx,x1,y1);
}
else{
if(x1-x0>y1-y0)
printf("%d %d %d %d\n",x1,y0,x1-y1+y0,y1), p+=2;
else{
t=Dot(-1,-1), dot[p+1]=dot[p], ++p;
printf("%d %.1lf %d %.1lf\n",x0,y1+0.5,x1,y1-x1+x0+0.5);
}
}
}
if(t.x!=-1&&p<=r){
int x=dot[p].x,y=dot[p].y,mx=max(x-t.x,y-t.y); ++p, t=Dot(-1,-1);
printf("%d %d %d %d\n",x-mx,y-mx,x,y);
}
if(p<=r) Solve0(p,r,t);
}
}
}
int main(){
T=1;
while(T--){
n=read();
for(register int i=1;i<=n;++i)
dot[i].x=read(), dot[i].y=read();
sort(dot+1,dot+1+n,cmp), Solve();
}
return 0;
Details
answer.code: In function ‘void Solve0(int, int, Dot&)’: answer.code:27:26: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 27 | for(register int i=l;i+1<=r;i+=2) Delete(i); | ^ answer.code: In function ‘void Solve()’: answer.code:33:26: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 33 | for(register int l=1,r=1;l<=n;l=r=r+1){ | ^ answer.code:33:30: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 33 | for(register int l=1,r=1;l<=n;l=r=r+1){ | ^ answer.code: In function ‘int main()’: answer.code:66:34: warning: ISO C++17 does not allow ‘register’ storage class specifier [-Wregister] 66 | for(register int i=1;i<=n;++i) | ^ answer.code:70:18: error: expected ‘}’ at end of input 70 | return 0; | ^ answer.code:62:11: note: to match this ‘{’ 62 | int main(){ | ^