QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#829487#8907. Конференцияkkkgjyismine40 2ms17968kbC++201.4kb2024-12-24 10:25:412024-12-24 10:25:43

Judging History

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

  • [2024-12-24 10:25:43]
  • 评测
  • 测评结果:0
  • 用时:2ms
  • 内存:17968kb
  • [2024-12-24 10:25:41]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define N 500005
int n,m,m1,vis[N],vis1[N],b[N],c[N];
int ql[N],qr[N],cl[N];
struct node{int l,r,x;}a[N];
bool operator<(node a,node b){
	if(a.r==b.r)return a.l>b.l;
	return a.r<b.r;
}
bool cmp(node a,node b){
	if(a.l==b.l)return a.r<b.r;
	return a.l>b.l;
}
void solve(){
	cin>>n,m=m1=0;
	for(int i=1;i<=n;++i){
		vis[i]=vis1[i]=0;
		cin>>a[i].l>>a[i].r,a[i].x=i;
		ql[i]=a[i].l,qr[i]=a[i].r;
	}
	sort(a+1,a+n+1);
	int tr=0;
	for(int i=1;i<=n;++i){
		if(a[i].l<=tr)continue;
		tr=a[i].r,vis[a[i].x]=1,b[++m]=a[i].x;
	}
	int tl=1e9;++tl;
	sort(a+1,a+n+1,cmp);
	for(int i=1;i<=n;++i){
		if(a[i].r>=tl)continue;
		tl=a[i].l,vis1[a[i].x]=1,c[++m1]=a[i].x;
	}
	int c1=0,c2=0,ct=n/2;
	for(int i=1;i<=n;++i){
		if(qr[i]<ql[c[m/2]])++c2;
		if(ql[i]>qr[b[m/2]])++c1;
		cl[i]=1;
	}
	if(c1<=n/2){
		for(int i=1;i<=n;++i)if(ql[i]>qr[b[m/2]])--ct,cl[i]=0;
		for(int i=1;i<=n;++i){
			if(!cl[i])continue;
			if(vis[i])continue;
			if(ct)--ct,cl[i]=0;
		}
		for(int i=1;i<=n;++i)if(cl[i])cout<<i<<" ";cout<<endl;
	}
	for(int i=1;i<=n;++i)if(qr[i]>ql[c[m/2]])--ct,cl[i]=0;
	for(int i=1;i<=n;++i){
		if(!cl[i])continue;
		if(vis1[i])continue;
		if(ct)--ct,cl[i]=0;
	}
	for(int i=1;i<=n;++i)if(cl[i])cout<<i<<" ";cout<<endl;
}
int main(){
	ios::sync_with_stdio(0); 
	int T;cin>>T;
	while(T--)solve();
	return 0;
} 

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 15932kb

input:

1
4
823983109 859315505
510901709 589624124
351308325 413158126
29447781 138101981

output:

3 4 
3 4 

result:

wrong output format Extra information in the output file (test case 1)

Subtask #2:

score: 0
Wrong Answer

Test #9:

score: 0
Wrong Answer
time: 0ms
memory: 17968kb

input:

1
10
4 6
15 20
1 12
11 16
3 10
13 19
5 18
7 8
2 17
9 14

output:

1 5 7 8 9 
1 8 

result:

wrong output format Extra information in the output file (test case 1)

Subtask #3:

score: 0
Skipped

Dependency #2:

0%

Subtask #4:

score: 0
Wrong Answer

Test #39:

score: 0
Wrong Answer
time: 2ms
memory: 17896kb

input:

1
10
8 9
15 18
12 13
5 14
7 10
1 20
2 19
6 11
3 4
16 17

output:

1 6 7 8 9 
1 9 

result:

wrong output format Extra information in the output file (test case 1)

Subtask #5:

score: 0
Skipped

Dependency #1:

0%

Subtask #6:

score: 0
Skipped

Dependency #2:

0%

Subtask #7:

score: 0
Skipped

Dependency #2:

0%

Subtask #8:

score: 0
Skipped

Dependency #1:

0%