QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#361040#8142. ElevatorxianjingWA 1ms3596kbC++14585b2024-03-22 18:23:432024-03-22 18:23:44

Judging History

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

  • [2024-03-22 18:23:44]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3596kb
  • [2024-03-22 18:23:43]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve(){
	int n,m;
	cin>>n>>m;
	pair<int,int>a[n];
	int b[n+1]={0};
	int ans[n];
	for(int i=0;i<n;i++){
		cin>>a[i].first;
		a[i].second=i;
	}
	sort(a,a+n);
	for(int i=0;i<n;i++){
		b[i+1]=b[i]+a[i].first;
	}
	ans[a[0].second]=0;
	for(int i=1;i<n;i++){
		ans[a[i].second]=i*a[i].first-b[i]+1;
		if(ans[a[i].second]>m-2) ans[a[i].second]=-1;
	}
	for(int i=0;i<n;i++){
		cout<<ans[i]<<"\n";
	}
	return;
}
signed main(){
	int t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;
}

详细

Test #1:

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

input:

6 20
3 8 12 6 9 9

output:

0
8
-1
4
11
11

result:

wrong answer 5th lines differ - expected: '13', found: '11'