/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Accepted 1ms 484.0 KiB
#3 Accepted 1ms 532.0 KiB
#4 Accepted 4ms 540.0 KiB
#5 Accepted 32ms 532.0 KiB
#6 Accepted 266ms 1.426 MiB
#7 Accepted 265ms 1.227 MiB
#8 Accepted 286ms 1.367 MiB
#9 Accepted 261ms 1.223 MiB
#10 Accepted 4ms 532.0 KiB

Code

#include <bits/stdc++.h>
//#define ll long long int

using namespace std;
typedef long long int ll;
priority_queue<int, vector<int>, greater<int>> pq;
const ll md = 1e9 + 7;
const ll md1 = 998244353;
map<ll, vector<ll>> tree;
//map<ll, int> mp;
bool ok(ll mid,ll k,ll hi){

ll lo=k;
ll h=hi;
while(lo<=h){
        ll md=(lo+h)/2;
ll tmp1=(md*(md+1))/2-(k*(k-1))/2;
ll tmp2=(hi*(hi+1))/2-(md*(md+1))/2;
if(tmp1-tmp2<((-1ll)*mid))lo=md+1;
else if(tmp1-tmp2>mid)h=md-1;
else return true;
}
return false;
}
void sufi() {
ll n,d;
cin>>n>>d;
ll a,b;
cin>>a>>b;
ll sum=min(n,d)*a;
n-=min(n,d);
sum+=n*b;
cout<<sum<<endl;
}
int main() {
    int t;
cin>>t;
    while (t--) {
        sufi();
       tree.clear();
        //mp.clear();
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1090 Summer trip
Contest
Brain Booster #5
Language
C++20 (G++ 13.2.0)
Submit At
2024-09-05 15:35:49
Judged At
2024-09-05 15:35:49
Judged By
Score
100
Total Time
286ms
Peak Memory
1.426 MiB