Submission #48104079


Source Code Expand

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;

#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i,n) for(ll i=n-1;i>=0;--i)
#define FOR(i,s,e) for(ll i=s;i<=e;++i)
#define FFOR(i,s,e) for(ll i=s;i>=e;--i)

#define yesno(flg) if(flg){cout<<"Yes"<<endl;}else{cout<<"No"<<endl;}
#define ALL(a) (a).begin(),(a).end()
#define mp make_pair
#define pb push_back
#define vl vector<ll>
#define vs vector<string>
#define so(a) sort(a.begin(),a.end())

#define fi first
#define se second
#define print(a) cout<<a<<endl
#define ssize(a) (ll)(a.size())

#define MAX_N 1002
#define i197 1000000007
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

typedef pair<int,int> Pi;
typedef pair<ll, ll> P2;
typedef pair<P2,ll> P3;
typedef pair<P2,P2> P4;

const ll INF=1000000000000000001;


int main(){

	ios::sync_with_stdio(0);
	cin.tie(0);


	ll n;
	cin>>n;
	ll s,m,l;
	cin>>s>>m>>l;
	vl dp(105);

	rep(i,105)dp[i]=INF;

	dp[0]=0;
	rep(i,n){
		if(i+6>n)chmin(dp[n],dp[i]+s);
		else chmin(dp[i+6],dp[i]+s);

		if(i+8>n)chmin(dp[n],dp[i]+m);
		else chmin(dp[i+8],dp[i]+m);

		if(i+12>n)chmin(dp[n],dp[i]+l);
		else chmin(dp[i+12],dp[i]+l);

	}
	print(dp[n]);



	return 0;
}






























Submission Info

Submission Time
Task B - Buy One Carton of Milk
User akarinkof
Language C++ 20 (gcc 12.2)
Score 200
Code Size 1434 Byte
Status AC
Exec Time 1 ms
Memory 3600 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 25
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
random_01.txt AC 1 ms 3388 KiB
random_02.txt AC 1 ms 3464 KiB
random_03.txt AC 1 ms 3460 KiB
random_04.txt AC 1 ms 3516 KiB
random_05.txt AC 1 ms 3460 KiB
random_06.txt AC 1 ms 3484 KiB
random_07.txt AC 1 ms 3520 KiB
random_08.txt AC 1 ms 3420 KiB
random_09.txt AC 1 ms 3452 KiB
random_10.txt AC 1 ms 3464 KiB
random_11.txt AC 1 ms 3476 KiB
random_12.txt AC 1 ms 3464 KiB
random_13.txt AC 1 ms 3396 KiB
random_14.txt AC 1 ms 3600 KiB
random_15.txt AC 1 ms 3516 KiB
random_16.txt AC 1 ms 3404 KiB
random_17.txt AC 1 ms 3320 KiB
random_18.txt AC 1 ms 3324 KiB
random_19.txt AC 1 ms 3448 KiB
random_20.txt AC 1 ms 3524 KiB
random_21.txt AC 1 ms 3472 KiB
random_22.txt AC 1 ms 3380 KiB
sample_01.txt AC 1 ms 3460 KiB
sample_02.txt AC 1 ms 3516 KiB
sample_03.txt AC 1 ms 3480 KiB