Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Electronics Shop
- #include <iostream>
- using namespace std;
- int main()
- {
- long long int b, key, usb, k[900001], u[900001], sum, max=-2;
- cin >> b >> key >> usb;
- for(long long int i=0;i<key;i++)
- {
- cin >> k[i];
- }
- for(long long int y=0;y<usb;y++)
- {
- cin >> u[y];
- }
- for(long long int i=0;i<key;i++)
- {
- for(long long int y=0;y<usb;y++)
- {
- sum = k[i]+u[y];
- if(sum<b && sum > max){max=sum;}
- }
- }
- if(max==-2){cout<<"-1";}
- else{cout << max;}
- return 0;
- }
Add Comment
Please, Sign In to add comment