Submission #3210976


Source Code Expand

Copy
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
using namespace std;
typedef long long ll;

ll a[300000];
int main(){
	ll n,x;cin>>n>>x;
	if(n>2000)abort();
	rep(i,n)scanf("%lld",&a[i]);
	ll ans=LLONG_MAX;
	for(ll k=1;k<=n;k++){//何回往復するか?
		ll cnt=(n+k)*x;
		rep(i,n){
			ll c=(n-i-1)/k;
			if(c==0)cnt+=5*a[i];
			else cnt+=(2*c+3)*a[i];
		}
		ans=min(ans,cnt);
	}
	cout<<ans<<endl;
}

Submission Info

Submission Time
Task B - Garbage Collector
User autumn_eel
Language C++14 (GCC 5.4.1)
Score 400
Code Size 436 Byte
Status
Exec Time 99 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:10:29: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  rep(i,n)scanf("%lld",&a[i]);
                             ^

Judge Result

Set Name Sample Subtask1 All
Score / Max Score 0 / 0 400 / 400 0 / 300
Status
× 4
× 16
× 16
× 16
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt, sample_04.txt
Subtask1 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 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 1 ms 256 KB
sample_03.txt 1 ms 256 KB
sample_04.txt 1 ms 256 KB
stest_01.txt 43 ms 256 KB
stest_02.txt 43 ms 256 KB
stest_03.txt 1 ms 256 KB
stest_04.txt 1 ms 256 KB
stest_05.txt 28 ms 256 KB
stest_06.txt 17 ms 256 KB
stest_07.txt 43 ms 256 KB
stest_08.txt 43 ms 256 KB
stest_09.txt 7 ms 256 KB
stest_10.txt 43 ms 256 KB
stest_11.txt 43 ms 256 KB
stest_12.txt 2 ms 256 KB
test_13.txt 98 ms 256 KB
test_14.txt 98 ms 256 KB
test_15.txt 97 ms 256 KB
test_16.txt 99 ms 256 KB
test_17.txt 98 ms 256 KB
test_18.txt 98 ms 256 KB
test_19.txt 98 ms 256 KB
test_20.txt 98 ms 256 KB
test_21.txt 99 ms 256 KB
test_22.txt 99 ms 256 KB
test_23.txt 99 ms 256 KB
test_24.txt 98 ms 256 KB
test_25.txt 98 ms 256 KB
test_26.txt 97 ms 256 KB
test_27.txt 98 ms 256 KB
test_28.txt 98 ms 256 KB