Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define FOR( i, f, t) for(int i = (f); i < (t); ++i)
- #define D(x) cout <<" "#x": " << x << endl;
- #define DRI(a) int a; cin >> a;
- map<int, int> lang;
- int main(){
- DRI(n); DRI(k);
- vector< int > a(n), b(n), c(n);
- FOR( i, 0, n ){
- DRI(x);
- a[i] = x;
- }
- FOR( i, 0, n ){
- DRI(x);
- b[i] = x;
- }
- int times = 0xffffff;
- FOR( i, 0, n ){
- int t = b[i] / a[i];
- if( t < times ){
- times = t;
- }
- }
- while( k > 0 ){
- FOR( i, 0, n ){
- if( b[i] / a[i] == times ) {
- int need = a[i] - (b[i] % a[i]);
- if( k >= need ) k -= need;
- else{
- k = 0; times --; break;
- }
- }
- }
- times ++;
- }
- cout << times << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement