結果

問題 No.919 You Are A Project Manager
ユーザー kotatsugamekotatsugame
提出日時 2019-10-25 23:03:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 751 bytes
コンパイル時間 797 ms
コンパイル使用メモリ 79,032 KB
実行使用メモリ 8,704 KB
最終ジャッジ日時 2023-10-11 07:56:58
合計ジャッジ時間 21,423 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2,864 ms
7,640 KB
testcase_01 AC 1 ms
4,352 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,352 KB
testcase_04 AC 95 ms
4,348 KB
testcase_05 AC 112 ms
4,352 KB
testcase_06 AC 6 ms
4,352 KB
testcase_07 AC 1,561 ms
4,352 KB
testcase_08 AC 105 ms
4,352 KB
testcase_09 AC 57 ms
4,352 KB
testcase_10 AC 172 ms
4,348 KB
testcase_11 AC 153 ms
4,348 KB
testcase_12 AC 2 ms
4,352 KB
testcase_13 AC 260 ms
4,352 KB
testcase_14 AC 3 ms
4,348 KB
testcase_15 AC 27 ms
4,348 KB
testcase_16 AC 492 ms
4,352 KB
testcase_17 AC 1,767 ms
4,348 KB
testcase_18 AC 1,765 ms
4,348 KB
testcase_19 AC 2,859 ms
4,348 KB
testcase_20 TLE -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:6:1: 警告: ISO C++ では型の無い ‘main’ の宣言を禁止しています [-Wreturn-type]
    6 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int N;
main()
{
	cin>>N;
	vector<int>A(N);
	for(int i=0;i<N;i++)cin>>A[i];
	long ans=0;
	for(int K=1;K<=N;K++)
	{
		vector<long>L(N/K),R(N/K);
		vector<int>a=A;
		for(int i=0;i*K+K<=N;i++)
		{
			sort(a.begin()+i*K,a.begin()+i*K+K);
			L[i]=a[i*K+(K-1)/2];
		}
		a=A;
		reverse(a.begin(),a.end());
		for(int i=0;i*K+K<=N;i++)
		{
			sort(a.begin()+i*K,a.begin()+i*K+K);
			R[i]=a[i*K+(K-1)/2];
		}
		for(int i=1;i<N/K;i++)
		{
			L[i]+=L[i-1];
			R[i]+=R[i-1];
		}
		for(int i=1;i<N/K;i++)
		{
			L[i]=max(L[i],L[i-1]);
			R[i]=max(R[i],R[i-1]);
		}
		for(int i=-1;i<N/K;i++)
		{
			int j=N/K-i-2;
			ans=max(ans,((i<0?0L:L[i])+(j<0?0L:R[j]))*K);
		}
	}
	cout<<ans<<endl;
}
0