QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#378081 | #5058. Prof. Pang Earning Aus | InfinityNS | RE | 0ms | 0kb | C++17 | 1.1kb | 2024-04-06 00:28:21 | 2024-04-06 00:28:22 |
answer
#include<bits/stdc++.h>
#define f first
#define s second
#define ll long long
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(),(x).end()
using namespace std;
vector<ll> x(6);
vector<int> n(2),k(6);
void test(){
for(int i=0;i<2;i++){
scanf("%i",&n[i]);
}
for(int i=0;i<6;i++){
scanf("%i",&k[i]);
}
ll ans=0;
for(x[4]=0;x[4]<=100;x[4]++){
for(x[5]=0;x[5]<=100;x[5]++){
x[0]=(n[0]-x[5]*k[5])/k[0];
if(x[0]<0)continue;
x[1]=x[0]*k[0]+x[5]*k[5]-x[4];
if(x[1]<0)continue;
x[2]=(n[1]-x[4]*k[4])/k[2];
if(x[2]<0)continue;
x[3]=x[2]*k[2]+x[4]*k[4]-x[5];
if(x[3]<0)continue;
if(x[0]==0&&x[2]==0)continue;
if(x[1]+x[4]>n[0])continue;
if(x[3]+x[5]>n[1])continue;
ans=max(ans,x[1]*k[1]+x[3]*k[3]-x[0]-x[2]);
}
}
printf("%lld\n",ans+1);
}
int main(){
freopen("in.txt","r",stdin);
int t;
scanf("%i",&t);
while(t--){
test();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Runtime Error
input:
6 2 2 2 2 2 2 2 2 78 74 5 3 10 2 4 7 31 75 3 6 6 1 8 4 91 86 4 2 9 5 8 5 48 89 3 9 2 3 5 7 13 25 5 7 6 1 2 4