Submission #1777749


Source Code Expand

#include <iostream>
#include <algorithm>
#include <array>
#include <cstdint>
#include <functional>
#include <map>
#include <math.h>
#include <queue>
#include <set>
#include <stdlib.h>
#include <string>
#include <vector>

#define INF 1000000000
#define MOD 1000000007
#define ll long long
#define rep(i,a,b) for(int i = (a); i < (b); ++i)
#define bitget(a,b) (((a) >> (b)) & 1)
#define vint vector<int>
#define vvint vector<vector<int>>
#define ALL(x) x.begin(),x.end()

using int32 = int_fast32_t;
using int64 = int_fast64_t;
using uint32 = uint_fast32_t;
using uint64 = uint_fast64_t;

using namespace std;

int main() {
	int64 n, a, b, c;
	scanf("%lld %lld %lld %lld", &n, &a, &b, &c);
	int64* d;
	d = (int64 *)calloc(n, sizeof(int64));
	rep(i, 0, n)
		scanf("%lld", &d[i]);
	sort(d, d + n);
	int itr = n - 1;
	int64 ansd = a, ansc = c;
	while (itr >= 0) {
		if (ansc*b < ansd*d[itr]) {
			ansd += b;
			ansc += d[itr];
			--itr;
		}
		else {
			break;
		}
	}
	int64 ans = ansc / ansd;
	printf("%lld\n", ans);
	return 0;
}

Submission Info

Submission Time
Task C - 最高のピザ (Best Pizza)
User noshi91
Language C++14 (GCC 5.4.1)
Score 100
Code Size 1076 Byte
Status AC
Exec Time 1 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:32:45: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 2 has type ‘int64* {aka long int*}’ [-Wformat=]
  scanf("%lld %lld %lld %lld", &n, &a, &b, &c);
                                             ^
./Main.cpp:32:45: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 3 has type ‘int64* {aka long int*}’ [-Wformat=]
./Main.cpp:32:45: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 4 has type ‘int64* {aka long int*}’ [-Wformat=]
./Main.cpp:32:45: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 5 has type ‘int64* {aka long int*}’ [-Wformat=]
./Main.cpp:36:22: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 2 has type ‘int64* {aka long int*}’ [-Wformat=]
   scanf("%lld", &d[i]);
                      ^
./Main.cpp:51:22: warning: format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘int64 {...

Judge Result

Set Name set01 set02 set03 set04 set05
Score / Max Score 20 / 20 20 / 20 20 / 20 20 / 20 20 / 20
Status
AC × 1
AC × 1
AC × 1
AC × 1
AC × 1
Set Name Test Cases
set01 data1
set02 data2
set03 data3
set04 data4
set05 data5
Case Name Status Exec Time Memory
data1 AC 1 ms 256 KB
data2 AC 1 ms 256 KB
data3 AC 1 ms 256 KB
data4 AC 1 ms 256 KB
data5 AC 1 ms 256 KB