/ SeriousOJ /

Record Detail

Runtime Error


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 540.0 KiB
#2 Accepted 1ms 372.0 KiB
#3 Accepted 1ms 352.0 KiB
#4 Accepted 2ms 504.0 KiB
#5 Accepted 5ms 540.0 KiB
#6 Accepted 64ms 1.355 MiB
#7 Runtime Error 388ms 9.469 MiB
#8 Runtime Error 380ms 9.801 MiB
#9 Runtime Error 378ms 9.664 MiB
#10 Accepted 1ms 328.0 KiB

Code

#include <bits/stdc++.h>
using namespace std;
#define SC               scanf
#define PF               printf
#define ull              unsigned long long
#define ld               long double
#define F                first
#define S                second
#define pb               push_back
#define sort_a(a)        sort(a.begin(),a.end());
#define sort_d(a)        sort(a.rbegin(),a.rend());
#define READ(f)          freopen(f, "r", stdin)
#define WRITE(f)         freopen(f, "w", stdout)
#define rev(s)           reverse(s.begin(),s.end())
#define P(ok)            cout << (ok ? "YES\n": "NO\n")
#define __Heart__              ios_base :: sync_with_stdio(false); cin.tie(NULL);
#define ll long long
typedef pair< ll , ll>                   PII;
void solve()
{
    ll n , d , a, b ; cin >> n >> d >> a >> b;
    ll Ans = min(n , d) * a ;
    n -= min(n , d) ;
    Ans = Ans + (n * b) ;
    cout << Ans << "\n" ;

}
int main()
{
     __Heart__
     //READ("input11.txt") ;
    // WRITE("output11.txt") ;
     int t ; cin >> t ; while(t--) solve() ;
}

Information

Submit By
Type
Submission
Problem
P1090 Summer trip
Language
C++20 (G++ 13.2.0)
Submit At
2024-08-17 23:05:00
Judged At
2024-08-17 23:05:00
Judged By
Score
70
Total Time
388ms
Peak Memory
9.801 MiB