/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 324.0 KiB
#2 Wrong Answer 1ms 532.0 KiB
#3 Wrong Answer 1ms 532.0 KiB

Code

/*
 * Author: Md. Mahfuzur Rahman
 * Purpose: Competitive Programming
 */

#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;

#define ll long long
#define pb push_back
#define endl '\n'
#define nl cout << endl
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define srt(v) sort(v.begin(),v.end())
#define pii pair<int, int>
#define pll pair<long,long>
#define FAST_IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define minheap priority_queue<long long, vector<long long>, greater<long long>>
#define maxheap priority_queue<long long, vector<long long>>
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds; // find_by_order, order_of_key

const int INF = 1e9;
const ll MOD = 1e9 + 7;
const double EPS = 1e-9;
const int MAX = 1e6;

#ifndef ONLINE_JUDGE
#define debug(x) cerr<<#x<<" = ";deb(x);
#else
#define debug(x)
#endif

template <typename T>
void deb(T x) { cerr <<"[ "<< x << " ]\n"; }
template <typename T, typename U>
void deb(pair<T, U> p) { cerr << "(" << p.first << ", " << p.second << ")\n"; }
template <typename T>
void deb(vector<T> v){cerr<<"[ ";for (T val : v) cerr << val << " ";cerr<<"]"<<endl;}
template <typename T>
void deb(vector<vector<T>> v){for (auto row : v)deb(row);}
template <typename T, typename U>
void deb(vector<pair<T, U>> vec){for ( auto p : vec){deb(p);}cerr << endl;}
template <typename T, typename U>
void deb(map<T,U>mp){for(auto x:mp)cerr<<"\n( "<<x.first<<" "<<x.second<<" )";cerr<<endl;}
template<typename T>
void deb(set<T>set){cerr<<"[ ";for(auto x:set)cerr<<x<<" ";cerr<<"]\n";}
template <typename... T>
void read(T&... args){((cin>>args), ...);}
template <typename... T>
void write(T... args){((cout<<args<<" "), ...);}

bitset<MAX> is_prime;
vector<int> primes;
void sieve()
{
    is_prime.set();
    is_prime[0] = is_prime[1] = 0;
    for (int i = 2; i < MAX; ++i)
    {
        if (is_prime[i])
        {
            primes.pb(i);
            for (int j = i * i; j < MAX; j += i)
            {
                is_prime[j] = 0;
            }
        }
    }
}

ll mod_add(ll a, ll b, ll m = MOD) { return (a % m + b % m) % m; }
ll mod_sub(ll a, ll b, ll m = MOD) { return ((a % m - b % m) + m) % m; }
ll mod_mul(ll a, ll b, ll m = MOD) { return (a % m * b % m) % m; }
ll mod_pow(ll a, ll b, ll m = MOD)
{
    ll res = 1;
    while (b > 0)
    {
        if (b & 1)
            res = mod_mul(res, a, m);
        
        a = mod_mul(a, a, m);
        b >>= 1;
    }
    return res;
}

// File I/O (uncomment if needed)
// ifstream infile("input.txt");
// ofstream outfile("output.txt");

void solve(int tc)
{
    ll n,d;cin>>n>>d;
    ll a,b; cin>>a>>b;
    cout<<d*a+(n-d)*b<<endl;
   
}

int main()
{
    FAST_IO;
    #ifndef ONLINE_JUDGE
    freopen("Error.txt","w",stderr);
    #endif
    int t = 1;
    int tc=1;
    cin >> t;
    while (t--)
    {
        solve(tc++);
    }
    // For file I/O
    // infile.close();
    // outfile.close();
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1090 Summer trip
Contest
Sylhet ICPC 2024 Collaborative Challenge: Episode 2
Language
C++17 (G++ 13.2.0)
Submit At
2024-10-30 08:52:13
Judged At
2024-11-11 02:35:38
Judged By
Score
10
Total Time
1ms
Peak Memory
532.0 KiB