QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#670291#7750. Revenge on My Bosslllei#WA 55ms6744kbC++14731b2024-10-23 21:11:402024-10-23 21:11:41

Judging History

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

  • [2024-10-23 21:11:41]
  • 评测
  • 测评结果:WA
  • 用时:55ms
  • 内存:6744kb
  • [2024-10-23 21:11:40]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
struct A
{
	long long a,b,c;
	int flag;
	int num;
}a[N];
int n;
long long tot=0;
bool ss(A t1,A t2)
{
	if(t1.flag!=t2.flag) return t1.flag<t2.flag;
	if(t1.flag){
		return t1.c>t2.c; //t1.c*(t1.a-t1.b)>t2.c*(t2.a-t2.b);
	}
	else return t1.c<t2.c;/*t1.c*(t1.b-t1.a)<t2.c*(t2.b-t2.a);*/
}

int main()
{
	int T;
	cin>>T;
	while(T--){
		tot=0;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i].a>>a[i].b>>a[i].c;
		if(a[i].a>a[i].b){ a[i].flag=1;}
		else a[i].flag=0;
		a[i].num=i;
		tot+=min(a[i].a,a[i].b);
	}
	sort(a+1,a+n+1,ss);
	for(int i=1;i<=n;i++)if(i!=n) cout<<a[i].num<<' ';
		else cout<<a[i].num;
	cout<<'\n';
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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:

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

result:

ok correct

Test #2:

score: -100
Wrong Answer
time: 55ms
memory: 6744kb

input:

1
100000
581297 102863 1
742857 42686 1
676710 233271 1
443055 491162 1
442056 28240 1
769277 331752 1
8608 369730 1
495112 525554 1
787449 938154 1
441186 850694 1
84267 925450 1
740811 32385 1
834021 37680 1
257878 564126 1
90618 914340 1
239641 463103 1
40687 343062 1
587737 458554 1
103684 48666...

output:

35058 82422 57821 35047 35048 82420 35050 35051 82419 35053 57820 35055 82417 82423 57818 35060 35061 35062 82414 35064 71065 82412 35067 82411 57816 82409 35029 35016 82437 35018 35019 57827 35021 35022 57826 35024 82434 35026 35027 82408 82431 82430 82429 82428 82427 35038 35039 82424 35041 35042 ...

result:

wrong answer Wrong Answer on Case#1