結果

問題 No.1416 ショッピングモール
ユーザー publflpublfl
提出日時 2021-03-05 21:28:05
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 25 ms / 1,000 ms
コード長 411 bytes
コンパイル時間 510 ms
コンパイル使用メモリ 56,004 KB
実行使用メモリ 12,236 KB
最終ジャッジ日時 2024-04-16 08:48:10
合計ジャッジ時間 1,780 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 18 ms
11,724 KB
testcase_01 AC 18 ms
11,720 KB
testcase_02 AC 18 ms
11,724 KB
testcase_03 AC 18 ms
11,592 KB
testcase_04 AC 18 ms
11,728 KB
testcase_05 AC 18 ms
11,720 KB
testcase_06 AC 18 ms
11,724 KB
testcase_07 AC 18 ms
11,724 KB
testcase_08 AC 19 ms
11,852 KB
testcase_09 AC 18 ms
11,728 KB
testcase_10 AC 18 ms
11,596 KB
testcase_11 AC 18 ms
11,852 KB
testcase_12 AC 18 ms
11,980 KB
testcase_13 AC 18 ms
11,720 KB
testcase_14 AC 18 ms
11,852 KB
testcase_15 AC 19 ms
11,724 KB
testcase_16 AC 18 ms
11,724 KB
testcase_17 AC 19 ms
11,852 KB
testcase_18 AC 19 ms
11,848 KB
testcase_19 AC 19 ms
11,724 KB
testcase_20 AC 19 ms
11,720 KB
testcase_21 AC 25 ms
11,980 KB
testcase_22 AC 25 ms
12,236 KB
testcase_23 AC 24 ms
12,112 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <algorithm>
#include <vector>

std::vector<int> V;
int x[500010],y[500010];
int main()
{
	for(int i=0;i<=20;i++) for(int j=1;j<=(1<<i);j++) V.push_back(i);
	
	int a;
	scanf("%d",&a);
	for(int i=1;i<=a;i++) scanf("%d",&x[i]);
	std::sort(x+1,x+a+1);
	for(int i=1;i<=a;i++) y[i] = x[a-i+1];
	
	long long int ans = 0;
	for(int i=1;i<=a;i++) ans += (y[i]*V[i-1]);
	printf("%lld\n",ans);
}
0