QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#261098#7750. Revenge on My BossLoging#WA 1ms7396kbC++141.0kb2023-11-22 17:56:592023-11-22 17:57:00

Judging History

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

  • [2023-11-22 17:57:00]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:7396kb
  • [2023-11-22 17:56:59]
  • 提交

answer

#include <bits/stdc++.h>

#define Max 100005
#define int long long

using namespace std;

struct Node{
	int a,b,c,d,id;
	inline bool operator<(const Node x)const{
		int sum1=max(1ll*c*(a+b)+1ll*c*x.b,1ll*x.c*(x.a+x.b)+1ll*x.c*b);
		int sum2=max(1ll*x.c*(x.a+x.b)+1ll*x.c*b,1ll*c*(a+b)+1ll*c*x.b);
		return sum1<sum2;
	}
}p[Max],q[Max];

int T,n,id[Max];

signed main(){
	ios::sync_with_stdio(false);
	cin>>T;
	while(T--){
		cin>>n;
		for(int i=1;i<=n;i++){
			p[i].id=i;
			cin>>p[i].a>>p[i].b>>p[i].c;
			if(p[i].a<p[i].b)p[i].d=-1;
			else if(p[i].a==p[i].b)p[i].d=0;
			else p[i].d=1;
		}
//		for(int i=1;i<=n;i++)cin>>id[i];
//		for(int i=1;i<=n;i++){
//			q[i]=p[id[i]];
//		}
//		for(int i=1;i<=n;i++)p[i]=q[i];
		sort(p+1,p+n+1);
		for(int i=1;i<=n;i++)cout<<p[i].id<<" ";cout<<'\n';
//		int ans=0;
//		for(int i=1;i<=n;i++){
//			int sum=0;
//			for(int j=1;j<=i;j++)sum+=p[j].a;
//			for(int j=i;j<=n;j++)sum+=p[j].b;
//			ans=max(ans,sum*p[i].c);
//		}
//		cout<<ans<<endl;
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 7396kb

input:

2
4
1 1 4
5 1 5
1 9 1
9 8 1
9
3 1 4
1 5 9
2 6 5
3 5 8
9 7 9
3 2 3
8 4 6
2 6 8
3 2 7

output:

1 2 3 4 
1 2 3 4 5 6 7 8 9 

result:

wrong answer Wrong Answer on Case#1