CARVIEW |
Select Language
HTTP/2 200
date: Sun, 12 Oct 2025 05:10:21 GMT
content-type: text/html; charset=UTF-8
server: cloudflare
x-frame-options: DENY
x-content-type-options: nosniff
x-xss-protection: 1;mode=block
vary: accept-encoding
cf-cache-status: DYNAMIC
content-encoding: gzip
set-cookie: _csrf-frontend=88aa77acb193f69b433e0e40b1962b4ec586e0f170ca1d234c7f13666602d183a%3A2%3A%7Bi%3A0%3Bs%3A14%3A%22_csrf-frontend%22%3Bi%3A1%3Bs%3A32%3A%22i5eBk1nBE1hG8TvgwYf0HFYYqsKsHtOy%22%3B%7D; HttpOnly; Path=/
cf-ray: 98d4171c9e58c537-BLR
#include <bits/stdc++.h>#define F first#define S second#define all(x) x.be - Pastebin.com
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #define F first
- #define S second
- #define all(x) x.begin(),x.end()
- #define endl '\n'
- using namespace std;
- using ll = long long;
- using pii = pair<int, int>;
- const int INF = 0x3f3f3f3f;
- const ll INFLL = 0x3f3f3f3f3f3f3f3fLL;
- const int MOD = 1000000007;
- const int dx[] = { 0, 0, -1, 1, 1, -1, 1, -1};
- const int dy[] = {-1, 1, 0, 0, 1, -1, -1, 1};
- ll AP(ll a, ll b){
- return ((a+b)*(b-a+1))/2;
- }
- const int MAXN = 200010;
- int a[MAXN], b[MAXN];
- int n, m;
- ll f(ll x){
- ll sum = 0;
- for(int i=0; i<n; i++){
- ll t = (a[i]-x)/b[i];
- if(x <= a[i])
- sum += (t+1);
- }
- return sum;
- }
- int main() {
- ios_base::sync_with_stdio(false); cin.tie(NULL);
- cin >> n >> m;
- for(int i=0; i<n; i++){
- cin >> a[i];
- }
- for(int i=0; i<n; i++){
- cin >> b[i];
- }
- ll lo=2, hi=1e9, mn=1;
- while(lo<=hi){
- ll mid = (lo+hi)/2;
- if(f(mid) >= m){
- mn = mid;
- lo = mid+1;
- }else{
- hi = mid-1;
- }
- }
- ll sum = 0;
- for(int i=0; i<n; i++){
- ll t = (a[i]-mn)/b[i];
- if(mn <= a[i]){
- sum += a[i]*(t+1) - b[i]*AP(0, t);
- }
- }
- ll get = f(mn);
- if(mn == 1){
- get += m;
- sum += m;
- }
- if(get >= m){
- sum -= (get-m)*mn;
- }
- cout << sum << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
-
✅ Make $2500 in 20 minutes⭐⭐⭐ H
JavaScript | 7 sec ago | 0.25 KB
-
📝 EASY MONEY GUIDE ✅ Working
JavaScript | 8 sec ago | 0.24 KB
-
⭐⭐⭐MAKE $900 INSTANTLY⭐⭐
Java | 9 sec ago | 0.10 KB
-
📌 Swapzone +37% glitch ⭐ 5
JavaScript | 16 sec ago | 0.25 KB
-
📝 Exchange profit method
JavaScript | 19 sec ago | 0.24 KB
-
⭐⭐⭐MAKE $9OO INSTANTLY D M⭐⭐
Java | 20 sec ago | 0.10 KB
-
✅⭐ Make huge profits on trading ⭐⭐ E
JavaScript | 25 sec ago | 0.25 KB
-
📌 Swapzone +37% glitch
JavaScript | 30 sec ago | 0.24 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand