https://codeforces.com/problemset/problem/1480/B
I solved this without AI and web
Code:
include
include
include
include
using namespace std;
int main() {
srand(time(0));
int A, B, n, c =0, z =0;
cin>>A>>B>>n;
int a[n], b[n];
for(int i = 0; i < n; i++){
cin>>a[i];
}
for(int i = 0; i < n; i++){
cin>>b[i];
}
for(int i = 0; i < n; i++){
int x = rand() % (0 - n);
while(1>0 == true){
B = B - a[x];
b[x] = b[x]-A;
if(b[x]<=0){z++; break;}
if((B <= 0)){break;}
}
if(z == n){ cout<<"Yes";}
if((B <= 0)&&(z!=n)){ cout<<"NO"; break;}
}
return 0;
}
Author Of article : Ibrahim Read full article