PE是什么梗?
查看原帖
PE是什么梗?
766675
da_ke楼主2023/4/30 14:43

好像是格式错误,这题格式是什么呀?

#include <bits/stdc++.h>

using namespace std;

int read(){int x;cin>>x;return x;}

struct Node{
	int id,t,s;
};

Node a[10024];

bool cmp(const Node& A,const Node& B){
	if(A.s*B.t!=B.s*A.t)
		return B.s*A.t<A.s*B.t;
	return A.id<B.id;
}

int main(){
	ios::sync_with_stdio(false);
	int t;
	cin>>t;
	while(t--){
		int n;
		cin>>n;
		for(int i=1;i<=n;++i)
			a[i]=(Node){i,read(),read()};
		sort(a+1,a+1+n,cmp);
		for(int i=1;i<n;++i)
			cout<<a[i].id<<' ';
		cout<<a[n].id;
        if(t==1)cout<<endl;
        else cout<<endl<<endl;
	}
}
2023/4/30 14:43
加载中...