QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#141065#6532. Tradingcy1999WA 0ms3376kbC++20748b2023-08-17 08:35:532023-08-17 08:35:53

Judging History

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

  • [2023-08-17 08:35:53]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3376kb
  • [2023-08-17 08:35:53]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
struct node{
    int a,b;
    friend bool operator<(node a,node b){
    	return a.a<b.a;
    }
}p[1000005];
int n,t,sum,r1,r2,nw;
signed main(){
	return 0;
	cin>>t;
	while(t--){
		cin>>n;sum=0;
		for(int i=1;i<=n;i++){
			scanf("%lld%lld",&p[i].a,&p[i].b);
			sum+=p[i].b;
		}
		sort(p+1,p+n+1);nw=0;r1=r2=0;
		for(int i=1;i<=n;i++){
			if(p[i].b+nw<=sum/2){
				nw+=p[i].b;
				r1+=p[i].a*p[i].b;
			}else{
				r1+=(sum/2-nw)*p[i].a;
				break;
			}
		}
		nw=0;
		for(int i=n;i>=1;i--){
			if(p[i].b+nw<=sum/2){
				nw+=p[i].b;
				r2+=p[i].a*p[i].b;
			}else{
				r2+=(sum/2-nw)*p[i].a;
				break;
			}
		}
		printf("%lld\n",r2-r1);
	}
}

詳細信息

Test #1:

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

input:

2
4
10 2
30 7
20 4
50 1
2
1 100
1 1000

output:


result:

wrong answer Answer contains longer sequence [length = 2], but output contains 0 elements