QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#644340 | #4671. Independent Rectangles | cjx | Compile Error | / | / | C++20 | 2.0kb | 2024-10-16 13:21:44 | 2024-10-16 13:21:47 |
Judging History
answer
#include<bits/stdc++.h>
#define ll long long
using namespace std;
long long read(){
long long x=0,f=1;char ch=getchar();
while(!isdigit(ch))
{if(ch=='-') f=-1;ch=getchar();}
while(isdigit(ch)){x=x*10+ch-48;ch=getchar();}
return x*f;
}
void write(long long x){
if(x<0) putchar('-'),x=-x;
if(x>9) write(x/10);
putchar(x%10+'0');
}
const int N=1e5+10;
int n;
struct Node{
int x1,y1,x2,y2;
}a[N];
int b[N][4];
bitset<N>s[N],zy[N];
int id[N],di[N],k;
bool cmp1(int p,int q){
return b[p][k]<b[q][k];
}
bool cmp2(int p,int q){
return b[p][k]<b[q][k];
}
void solve(int n){
for(int i=1;i<=n;i++)id[i]=di[i]=i;
for(int i=1;i<=n;i++)s[i].set();
k=0;sort(id+1,id+n+1,cmp1);
k=2;sort(di+1,di+n+1,cmp1);
for(int i=1;i<=n;i++)zy[i]=zy[i-1],zy[i].set(id[i]);
for(int i=1,j=0;i<=n;i++){
while(j+1<=n&&b[id[j+1]][0]<b[di[i]][2])j++;
s[di[i]]&=zy[j];
}
k=2;sort(id+1,id+n+1,cmp2);
k=0;sort(di+1,di+n+1,cmp2);
for(int i=1;i<=n;i++)zy[i]=zy[i-1],zy[i].set(id[i]);
for(int i=1,j=0;i<=n;i++){
while(j+1<=n&&b[id[j+1]][2]>b[di[i]][0])j++;
s[di[i]]&=zy[j];
}
k=1;sort(id+1,id+n+1,cmp1);
k=3;sort(di+1,di+n+1,cmp1);
for(int i=1;i<=n;i++)zy[i]=zy[i-1],zy[i].set(id[i]);
for(int i=1,j=0;i<=n;i++){
while(j+1<=n&&b[id[j+1]][1]<b[di[i]][3])j++;
s[di[i]]&=zy[j];
}
k=3;sort(id+1,id+n+1,cmp2);
k=1;sort(di+1,di+n+1,cmp2);
for(int i=1;i<=n;i++)zy[i]=zy[i-1],zy[i].set(id[i]);
for(int i=1,j=0;i<=n;i++){
while(j+1<=n&&b[id[j+1]][3]>b[di[i]][1])j++;
s[di[i]]&=zy[j];
}
}
int main(){
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
n=read();
for(int i=1;i<=n;i++){
b[i][0]=a[i].x1=read();
b[i][1]=a[i].y1=read();
b[i][2]=a[i].x2=read();
b[i][3]=a[i].y2=read();
}
solve(n);
for(int i=1;i<=n;i++){
if(s[i].count()!=2){
for(int j=0;j<4;j++)swap(b[i][j],b[n][j]);
n--;i--;
}
}
solve(n);
int ans=0;
for(int i=1;i<=n;i++){
if(s[i].count()==2)ans++;
}
write(ans/2);puts("");
return 0;
}
详细
/tmp/ccjurSTY.o: in function `cmp1(int, int)': answer.code:(.text+0x14): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccjurSTY.o /tmp/ccjurSTY.o: in function `cmp2(int, int)': answer.code:(.text+0x44): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccjurSTY.o /tmp/ccjurSTY.o: in function `solve(int)': answer.code:(.text+0x3da): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccjurSTY.o answer.code:(.text+0x50b): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccjurSTY.o answer.code:(.text+0x632): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccjurSTY.o answer.code:(.text+0x758): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccjurSTY.o /tmp/ccjurSTY.o: in function `main': answer.code:(.text.startup+0x19): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccjurSTY.o answer.code:(.text.startup+0x28): relocation truncated to fit: R_X86_64_PC32 against symbol `a' defined in .bss section in /tmp/ccjurSTY.o answer.code:(.text.startup+0x2f): relocation truncated to fit: R_X86_64_PC32 against symbol `b' defined in .bss section in /tmp/ccjurSTY.o answer.code:(.text.startup+0x6d): relocation truncated to fit: R_X86_64_PC32 against symbol `n' defined in .bss section in /tmp/ccjurSTY.o answer.code:(.text.startup+0x84): additional relocation overflows omitted from the output collect2: error: ld returned 1 exit status