QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#361040 | #8142. Elevator | xianjing | WA | 1ms | 3596kb | C++14 | 585b | 2024-03-22 18:23:43 | 2024-03-22 18:23:44 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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'