QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#669988#7750. Revenge on My Bosslllei#WA 65ms6612kbC++14720b2024-10-23 20:11:162024-10-23 20:11:16

Judging History

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

  • [2024-10-23 20:11:16]
  • 评测
  • 测评结果:WA
  • 用时:65ms
  • 内存:6612kb
  • [2024-10-23 20:11:16]
  • 提交

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.a-t2.b+tot)>t2.c*(t1.a-t1.b+tot);
	}
	else return t1.c*(t2.b-t2.a+tot)<t2.c*(t1.b-t1.a+tot);
}

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;
}

详细

Test #1:

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

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 8 4 2 5 9 7 1 6

result:

ok correct

Test #2:

score: -100
Wrong Answer
time: 65ms
memory: 6612kb

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:

77582 77581 82112 72163 18220 43645 30468 80107 54173 17444 14872 8630 50133 26305 35 70096 40298 10072 56385 75312 79444 19284 81622 95793 96892 82320 8443 11434 56765 72103 89089 86041 48305 32033 88191 83243 9383 66880 81866 31386 23642 79775 66240 99937 38682 18931 39524 48449 36540 202 11001 62...

result:

wrong answer Wrong Answer on Case#1