QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#450429#5056. RooksczrqRE 0ms3572kbC++141.2kb2024-06-22 13:11:442024-06-22 13:11:44

Judging History

你现在查看的是最新测评结果

  • [2024-06-22 13:11:44]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:3572kb
  • [2024-06-22 13:11:44]
  • 提交

answer

# include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int M=1e5+5;
struct node{
	int x,y,idx,player;
}a[M];
bool cmp1(node &a1,node &a2)
{
	if(a1.x==a2.x)
	return a1.y<a2.y;
	else return a1.x<a2.x;
}
bool cmp2(node &a1,node &a2)
{
	if(a1.y==a2.y)
	return a1.x<a2.x;
	else return a1.y<a2.y;
}
bool va[M],vb[M];
int n1,n2;
int main()
{
	cin>>n1>>n2;
	for(int i=1;i<=n1;i++)
	{
		cin>>a[i].x>>a[i].y;
		a[i].player=1;
		a[i].idx=i;
	}
	for(int i=n1+1;i<=n1+n2;i++)
	{
		cin>>a[i].x>>a[i].y;
		a[i].player=2;
		a[i].idx=i-n1;
	}
	sort(a+1,a+n1+n2+1,cmp1);
	for(int i=2;i<=n1+n2;i++)
	{
		if(a[i].x!=a[i-1].x) continue;
		if(a[i].player==a[i-1].player) continue;
		if(a[i].player==1)
		{
			va[a[i].idx]=vb[a[i-1].idx]=1;
		}
		else	va[a[i-1].idx]=vb[a[i].idx]=1;
	}
		sort(a+1,a+n1+n2+1,cmp2);
	for(int i=2;i<=n1+n2;i++)
	{
		if(a[i].y!=a[i-1].y) continue;
		if(a[i].player==a[i-1].player) continue;
		if(a[i].player==1)
		{
			va[a[i].idx]=vb[a[i-1].idx]=1;
		}
		else	va[a[i-1].idx]=vb[a[i].idx]=1;
	}
	for(int i=1;i<=n1;i++)
	{
		cout<<va[i];
	}
	cout<<endl;
	for(int i=1;i<=n2;i++) cout<<vb[i];
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3572kb

input:

3 2
0 0
0 1
1 0
0 -1
-1 0

output:

100
11

result:

ok 2 lines

Test #2:

score: -100
Runtime Error

input:

187412 182667
-327232186 -214705485
-279803667 -350035994
446206005 303615216
-834968603 -136732317
419632506 1673410
-214090981 480011719
-248456581 553497885
50306201 876562462
-392778714 -25359124
463575002 914295696
591029109 -141911749
263944392 482282125
-81681320 764614792
621845261 -16628790...

output:


result: