/ SeriousOJ /

Record Detail

Accepted


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 324.0 KiB
#2 Accepted 1ms 324.0 KiB
#3 Accepted 1ms 324.0 KiB
#4 Accepted 2ms 576.0 KiB
#5 Accepted 6ms 576.0 KiB
#6 Accepted 44ms 1.367 MiB
#7 Accepted 41ms 1.348 MiB
#8 Accepted 41ms 1.418 MiB
#9 Accepted 41ms 1.336 MiB
#10 Accepted 1ms 320.0 KiB

Code

// PIPRA ||  HABIB
#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace std;

#define int        long long int
#define pb         push_back
#define all(x)     x.begin(),x.end()
#define allr(x)    x.rbegin(),x.rend()
#define ii         pair<int,int>
#define endl       "\n"

template<typename T>
ostream& operator<<(ostream &os, const vector<T> &v) {
    os << '{';
    for (const auto &x : v) os << " " << x;
        return os << '}';
}
using orderedTree = tree<int, null_type, less<int>, 
rb_tree_tag, tree_order_statistics_node_update>;

void pipra(){
    int n, k;   cin >> n >> k;
    int a, b;   cin >> a >> b;

    int mn = min(n, k);
    n -= mn;
    cout << ((mn * a) + (n * b)) << endl;
}

int32_t main(){
    // HABIB
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); cout.tie(NULL);

    int t;    cin>>t;
    while(t--) {
        pipra();
    }
    return 0 ;
}

Information

Submit By
Type
Submission
Problem
P1090 Summer trip
Language
C++17 (G++ 13.2.0)
Submit At
2024-10-14 12:52:27
Judged At
2024-11-11 02:36:53
Judged By
Score
100
Total Time
44ms
Peak Memory
1.418 MiB