ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#212540 | #3839. 小t爱算数(mul) | 18550161685 | 0 | 0ms | 0kb | C++ | 693b | 2024-10-19 11:01:09 | 2024-10-19 12:34:38 |
answer
#include<bits/stdc++.h>
using namespace std;
long long a[100005],f[100005];
long long t,n,m,ans;
signed main(){
freopen("dinner.in","r",stdin);
freopen("dinner.out","w",stdout);
cin>>n>>m>>t;
for(long long i=1;i<=m;i++){
cin>>a[i];
}
sort(a+1,a+m+1);
for(long long i=1;i<m;i++){
if((a[m]-a[i])%t!=0){
f[i]=(a[m]-a[i])/t+1;
ans=(a[m]-a[i])/t+1+ans;
}
else{
f[i]=(a[m]-a[1])/t;
ans=(a[m]-a[i])/t+ans;
}
if(ans>n){
break;
}
}
long long nxt=m;
while(ans<n){
f[nxt]+=1;
nxt++;
nxt=nxt%m;
ans+=1;
}
long long maxn=-1;
for(long long i=1;i<=m;i++){
maxn=max(maxn,a[i]+t*f[i]);
}
cout<<maxn;
return 0;
}
详细
小提示:点击横条可展开更详细的信息
Test #1:
score: 0
Dangerous Syscalls
input:
10 -7 9 3 7 4 6 -3 4 2 3 -7 2 -7 0 -3 -1 10 -9 8 9 7 -6 6 7 5 -2 3 -9 2 -9 1 7 0 3 -1
output:
result:
Test #2:
score: 0
Dangerous Syscalls
input:
4 3 2 -2 -1 4 3 2 2 -1
output:
result:
Test #3:
score: 0
Dangerous Syscalls
input:
100 -7 99 73 98 30 97 44 96 -23 95 -40 94 92 93 -87 92 -27 91 40 90 -3 89 -9 88 -60 87 99 86 -16 85 ...
output:
result:
Test #4:
score: 0
Dangerous Syscalls
input:
1000 -807 999 73 998 930 997 544 996 -923 995 -440 994 492 993 -987 992 -327 991 840 990 -303 989 -7...
output:
result:
Test #5:
score: 0
Dangerous Syscalls
input:
1000 -807 999 73 998 930 997 544 996 -923 995 -440 994 492 993 -987 992 -327 991 840 990 -303 989 -7...
output:
result:
Test #6:
score: 0
Dangerous Syscalls
input:
1000 -807 999 73 998 930 997 544 996 -923 995 -440 994 492 993 -987 992 -327 991 840 990 -303 989 -7...
output:
result:
Test #7:
score: 0
Dangerous Syscalls
input:
3 1 2 -1 0 1 -1 1 1 -1
output:
result:
Test #8:
score: 0
Dangerous Syscalls
input:
999 -807 998 73 997 930 996 544 995 -923 994 -440 993 492 992 -987 991 -327 990 840 989 -303 988 -70...
output:
result:
Test #9:
score: 0
Dangerous Syscalls
input:
0 -807 1 73 2 930 3 544 4 -923 5 -440 6 492 7 -987 8 -327 9 840 10 -303 11 -709 12 -560 13 99 14 -81...
output:
result:
Test #10:
score: 0
Dangerous Syscalls
input:
0 -807 1 73 2 930 3 544 4 -923 5 -440 6 492 7 -987 8 -327 9 840 10 -303 11 -709 12 -560 13 99 14 -81...