Submission #1540628


Source Code Expand

#include <bits/stdc++.h>
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define MAXN 100005
#define lint long long
#define trace(x) cout<<#x<<" = "<<x<<'\n'
#define trace2(x, y) cout<<#x<<" = "<<x<<" "<<#y<<" = "<<y<<'\n'
#define tracea(arr, i) cout<<#arr<<"["<<i<<"]"<<" = "<<arr[i]<<'\n'
#define print(arr, n) for (int iDx = 0; iDx < (n); iDx++) cout << arr[iDx] << " \n"[iDx == (n)-1]
#define sz(x) (int)(x).size()
using namespace std;
struct ii {
	lint a, b;
	bool operator < (ii o) const { return a*o.b > o.a*b; }
};
struct iii {
	int a, b, c;
	bool operator < (iii o) const { return make_tuple(a, b, c) < make_tuple(o.a, o.b, o.c); }
};
int TC, M, K, Q, x, y, z;

lint N, arr[5];
priority_queue<ii> pq;

int main() {
	#ifdef FAIRUZI10
	freopen("/home/fairuzi/Documents/CP/input.in", "r", stdin);
	#endif
	
	scanf("%lld%lld%lld%lld", &arr[0], &arr[1], &arr[2], &arr[3]);
	pq.push({arr[0], 1});
	pq.push({arr[1], 2});
	pq.push({arr[2], 4});
	pq.push({arr[3], 8});
	scanf("%lld", &N);
	N <<= 2;
	lint ans = 0;
	while (N) {
		ii now = pq.top();
		pq.pop();
		lint banyak = N/now.b;
		ans += banyak*now.a;
		N %= now.b;
	}
	printf("%lld\n", ans);
	
	return 0;
}

Submission Info

Submission Time
Task A - Ice Tea Store
User Fairuzi10
Language C++14 (GCC 5.4.1)
Score 300
Code Size 1210 Byte
Status AC
Exec Time 1 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:30:63: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld%lld%lld%lld", &arr[0], &arr[1], &arr[2], &arr[3]);
                                                               ^
./Main.cpp:35:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%lld", &N);
                   ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 4
AC × 23
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
All sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt
Case Name Status Exec Time Memory
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
sample_03.txt AC 1 ms 256 KB
sample_04.txt AC 1 ms 256 KB
subtask_1_01.txt AC 1 ms 256 KB
subtask_1_02.txt AC 1 ms 256 KB
subtask_1_03.txt AC 1 ms 256 KB
subtask_1_04.txt AC 1 ms 256 KB
subtask_1_05.txt AC 1 ms 256 KB
subtask_1_06.txt AC 1 ms 256 KB
subtask_1_07.txt AC 1 ms 256 KB
subtask_1_08.txt AC 1 ms 256 KB
subtask_1_09.txt AC 1 ms 256 KB
subtask_1_10.txt AC 1 ms 256 KB
subtask_1_11.txt AC 1 ms 256 KB
subtask_1_12.txt AC 1 ms 256 KB
subtask_1_13.txt AC 1 ms 256 KB
subtask_1_14.txt AC 1 ms 256 KB
subtask_1_15.txt AC 1 ms 256 KB