Submission #3214956


Source Code Expand

Copy
#include <iostream>
using namespace std;

long long n, m;
long long a[200000];

int main()
{
	cin >> n >> m;

	long long t = 2 * n * m;

	for (long long i = 0; i < n; i++) {
		cin >> a[i];
		t += 5 * a[i];
	}

	for (long long k = 1; k < n; k++) {
		long long t1 = (n + k) * m;

		for (long long i = 0; i < n; i++)
			t1 += (2 * (i / k) + 3) * a[n - 1 - i];

		for (long long i = 0; i / k < 1; i++)
			t1 += 2 * a[n - 1 - i];

		if (t1 < t)
			t = t1;
	}

	cout << t << endl;

	return 0;
}

Submission Info

Submission Time
Task B - Garbage Collector
User atjh16
Language C++14 (GCC 5.4.1)
Score 400
Code Size 521 Byte
Status

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
Subtask1 400 / 400 sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, stest_01.txt, stest_02.txt, stest_03.txt, stest_04.txt, stest_05.txt, stest_06.txt, stest_07.txt, stest_08.txt, stest_09.txt, stest_10.txt, stest_11.txt, stest_12.txt
All 0 / 300 sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt, stest_01.txt, stest_02.txt, stest_03.txt, stest_04.txt, stest_05.txt, stest_06.txt, stest_07.txt, stest_08.txt, stest_09.txt, stest_10.txt, stest_11.txt, stest_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt
Case Name Status Exec Time Memory
sample_01.txt 1 ms 256 KB
sample_02.txt 3 ms 256 KB
sample_03.txt 1 ms 256 KB
sample_04.txt 1 ms 256 KB
stest_01.txt 65 ms 256 KB
stest_02.txt 64 ms 256 KB
stest_03.txt 1 ms 256 KB
stest_04.txt 2 ms 256 KB
stest_05.txt 42 ms 256 KB
stest_06.txt 25 ms 256 KB
stest_07.txt 64 ms 256 KB
stest_08.txt 64 ms 256 KB
stest_09.txt 9 ms 256 KB
stest_10.txt 64 ms 256 KB
stest_11.txt 64 ms 256 KB
stest_12.txt 3 ms 256 KB
test_13.txt
test_14.txt
test_15.txt
test_16.txt
test_17.txt
test_18.txt
test_19.txt
test_20.txt
test_21.txt
test_22.txt
test_23.txt
test_24.txt
test_25.txt
test_26.txt
test_27.txt
test_28.txt