QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#62359 | #1864. Might and Magic | lmeowdn | WA | 3ms | 3488kb | C++17 | 1.0kb | 2022-11-18 13:58:29 | 2022-11-18 13:58:30 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
#define eb emplace_back
#define fi first
#define se second
#define pc __builtin_popcount
typedef pair<int,int> pii;
typedef vector<int> vi;
long long read() {
long long res=0, w=1; char c=getchar();
while(!isdigit(c)) {if(c=='-') w=-1; c=getchar();}
while(isdigit(c)) {res=res*10+c-'0'; c=getchar();}
return res*w;
}
int cp,cm,h0,a1,d1,n,T,ans;
signed main() {
T=read();
while(T--) {
cp=read(), cm=read(), h0=read()-1, a1=read(), d1=read(), n=read();
ans=max(cp*max(1ll,n),cm*(n-1));
for(int l=1,r;l<=h0;l=r+1) {
r=h0/(h0/l);
int x=h0/l+1, d0=max(0ll,a1-r/cp), m=n-d0;
//cout<<x<<" "<<l<<" "<<r<<" "<<d0<<" "<<m<<endl;
if(m<0) continue;
//physic
int att=cp*max(1ll,m-d1);
ans=max(ans,att*x);
//magic
m-=x; if(m<=0) continue;
att=cm*x;
ans=max(ans,att*x);
}
printf("%lld\n",ans);
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 3ms
memory: 3488kb
input:
2 1 1 4 5 1 4 2 5 1 9 9 6
output:
4 25
result:
ok 2 number(s): "4 25"
Test #2:
score: -100
Wrong Answer
time: 3ms
memory: 3428kb
input:
100 1 1000000 1000000 1 1 1000000 1 1 63 17 3 16 5 3 73 3 10 16 5 2 23 20 5 19 5 4 30 16 5 16 1 1 76 14 1 13 374334 265401 231663 11 3 4 204467 215696 313373 10 1 10 457955 456092 253432 17 5 9 643 474603 40411 20 4 7 35009 444310 461190 5 4 11 1 1 142615 53408 206285 486539 1 1 64714 344368 141319 ...
output:
250000000000000000 63 1095 95 150 76 1497336 64074437191 4121595 7593648 32291601420 32351784905 144413 1084516624 23792 54687 36719904038 102709259153 24982059009 122260194720 318231902520 290947644 222255768 8953991 24315942 372764916 8156076721 18321788164 32442715074308 31693612729 5625926661630...
result:
wrong answer 1st numbers differ - expected: '250000000000500000', found: '250000000000000000'