/ SeriousOJ /

Record Detail

Time Exceeded


  
# Status Time Cost Memory Cost
#1 Wrong Answer 2ms 328.0 KiB
#2 Wrong Answer 3ms 332.0 KiB
#3 Wrong Answer 12ms 624.0 KiB
#4 Wrong Answer 12ms 584.0 KiB
#5 Wrong Answer 22ms 668.0 KiB
#6 Wrong Answer 202ms 1.789 MiB
#7 Time Exceeded ≥1021ms ≥6.625 MiB
#8 Time Exceeded ≥1048ms ≥5.055 MiB
#9 Time Exceeded ≥1072ms ≥5.824 MiB
#10 Time Exceeded ≥1024ms ≥9.719 MiB
#11 Time Exceeded ≥1019ms ≥8.285 MiB

Code

/*Rabbi Zidni Eilmaa*/

// We are open. We are looking for SHOTRUJ...
 
#include<bits/stdc++.h>
using namespace std;
 
typedef long long int ll;
typedef long double ld;
typedef string str;
typedef vector<ll> vll;
typedef vector<pair<ll, ll>> vpl;
typedef set<ll> sll;
typedef map<ll,ll> mll;
typedef pair<int,int> pint;
typedef pair<ll,ll> pll;
double pi = acos(-1.0);
#define debug(x) cout<<#x<<" "<<x<<endl;
#define loop for(int i=1; i<=n; i++)
#define all(a) (a).begin(), (a).end()
#define min3(a,b,c) min(a,min(b,c))
#define max3(a,b,c) max(a,max(b,c))
#define min4(a,b,c,d) min(a,min(b,min(c,d)))
#define max4(a,b,c,d) max(a,max(b,max(c,d)))
#define forn(i, n) for(int i=1; i<=(int)n; i++)
#define ANS cout << ans << "\n"
#define PY cout << "YES\n"
#define PN cout << "NO\n" 

int mod = 1e9 + 7;

void init(){
    
}

void solve()
{
    ll n, k;
    cin >> n >> k;

    ll lo = 1, hi = k / n, ans = 0;
    while(lo <= hi) {
        ll mid = (lo + hi) / 2;
        cout << mid << endl;
        ll rem = k - mid * n;
        if(rem >= mid) {
            ans = max({ans, rem * mid, (rem - n) * (mid + 1)});
            lo = mid + 1;
        } else hi = mid - 1;
    }

    cout << ans << '\n';

    return;
}

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
 
    init();
    int t = 1;
    cin >> t;
    for(int i=1; i<=t; i++){
        // cout << "Case " << i << ": ";
        solve();
    }
 
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1092 Bitwise AND
Contest
Brain Booster #5
Language
C++20 (G++ 13.2.0)
Submit At
2024-09-05 16:14:22
Judged At
2024-10-03 13:08:28
Judged By
Score
0
Total Time
≥1072ms
Peak Memory
≥9.719 MiB