Submission

Status:

[PP][P][P][P][P]

Subtask/Task Score:

{20/20}{20/20}{20/20}{20/20}{20/20}

Score: 100

User: Zailagend1

Problemset: ติดตั้งหลอดไฟ

Language: cpp

Time: 0.002 second

Submitted On: 2026-09-30 15:02:22

#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
  cin.tie(0)->sync_with_stdio(false);
  int a;
  cin >> a;
  vector<int> c(a);
  for(int i = 0;i<a;i++){
    cin >> c[i];
  }
  sort(c.begin(),c.end());
  int counter = 0;
  int result = 0;
  for(int x : c){
    counter += x;
    result += counter*2;
  }
  cout << result;
}