Language: C++

#include<bits/stdc++.h>
using namespace std;
const int MAXN=2e4+5;
const int MAXM=400000010;
int n;
struct node
{
	int x,y;
}sv[MAXN];
struct Edge
{
	int to,next;
}edge[MAXM];
int head[MAXN],tot;
void init()
{
	tot=0;
	memset(head,-1,sizeof(head));
}
void addedge(int u,int v)
{
	edge[tot].to=v;edge[tot].next=head[u];head[u]=tot++;
} 
bool vis[MAXN];//染色标记，为true表示选择
int S[MAXN],top;//栈
bool dfs(int u)
{
	if(vis[u^1])return false;
	if(vis[u])return true;
	vis[u]=true;
	S[top++]=u;
	for(int i=head[u];i!=-1;i=edge[i].next)
		if(!dfs(edge[i].to))
			return false;
	return true;
}
bool Twosat(int n)
{
	memset(vis,false,sizeof(vis));
	for(int i=0;i<n;i+=2)
	{
		if(vis[i]||vis[i^1])continue;
		top=0;
		if(!dfs(i))
		{
			while(top)vis[S[--top]]=false;
			if(!dfs(i^1)) return false;
		}
	}
	return true;
}
bool judge(int now)
{
	init();
	for(int i=0;i<n;i++)
	{
		for(int j=i+1;j<n;j++)
		{
			int u,v;
			if(i==j)
			{
				continue;
			}
			if(abs(sv[i].x-sv[j].x)<now)
			{
				u=i*2,v=j*2;
				addedge(u,v^1);
				addedge(v,u^1);
			}
			if(abs(sv[i].x-sv[j].y)<now)
			{
				u=i*2,v=(j*2)^1;
				addedge(u,v^1);
				addedge(v,u^1);
			}
			if(abs(sv[i].y-sv[j].x)<now)
			{
				u=(i*2)^1,v=j*2;
				addedge(u,v^1);
				addedge(v,u^1);
			}
			if(abs(sv[i].y-sv[j].y)<now)
			{
				u=(i*2)^1,v=(j*2)^1;
				addedge(u,v^1);
				addedge(v,u^1);
			}
		}
	}
	return Twosat(2*n);
}
int main()
{
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	scanf("%d",&n);
	for(int i=0;i<n;i++)
	{
		scanf("%d%d",&sv[i].x,&sv[i].y);
	}
	int l=1,r=1e9,ans=0;
	while(l<=r)
	{
		int mid=(l+r)>>1;
		if(judge(mid))
		{
			ans=max(ans,mid);
			l=mid+1;
		}
		else
		{
			r=mid-1;
		}
	}
	printf("%d\n",ans);
	return 0;
}


Compiler output:
/tmp/ccVHgc1e.o: in function `init()':
a.cc:(.text+0x6): relocation truncated to fit: R_X86_64_PC32 against symbol `tot' defined in .bss section in /tmp/ccVHgc1e.o
a.cc:(.text+0x1b): relocation truncated to fit: R_X86_64_PC32 against symbol `head' defined in .bss section in /tmp/ccVHgc1e.o
/tmp/ccVHgc1e.o: in function `addedge(int, int)':
a.cc:(.text+0x36): relocation truncated to fit: R_X86_64_PC32 against symbol `tot' defined in .bss section in /tmp/ccVHgc1e.o
a.cc:(.text+0x53): relocation truncated to fit: R_X86_64_PC32 against symbol `tot' defined in .bss section in /tmp/ccVHgc1e.o
a.cc:(.text+0x67): relocation truncated to fit: R_X86_64_PC32 against symbol `head' defined in .bss section in /tmp/ccVHgc1e.o
a.cc:(.text+0x85): relocation truncated to fit: R_X86_64_PC32 against symbol `tot' defined in .bss section in /tmp/ccVHgc1e.o
a.cc:(.text+0x8e): relocation truncated to fit: R_X86_64_PC32 against symbol `tot' defined in .bss section in /tmp/ccVHgc1e.o
a.cc:(.text+0xa3): relocation truncated to fit: R_X86_64_PC32 against symbol `head' defined in .bss section in /tmp/ccVHgc1e.o
/tmp/ccVHgc1e.o: in function `dfs(int)':
a.cc:(.text+0xc3): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/ccVHgc1e.o
a.cc:(.text+0xe1): relocation truncated to fit: R_X86_64_PC32 against symbol `vis' defined in .bss section in /tmp/ccVHgc1e.o
a.cc:(.text+0xff): additional relocation overflows omitted from the output
collect2: error: ld returned 1 exit status