Submission #47990504


Source Code Expand

#include<bits/stdc++.h>
using namespace std;

int main(){
  int n;
  cin >> n;
  vector<int>a(n);
  for(int i=0;i<n;i++)cin >> a[i];

  map<int,vector<int>>d;
  for(int i=0;i<n;i++)d[a[i]].push_back(i);

  long long s=accumulate(a.begin(),a.end(),0LL);
  vector<long long>ans(n);
  for(auto[v,i_list]:d){
    s-=(long long)v*i_list.size();
    for(auto i:i_list)ans[i]=s;
  }

  for(auto x:ans)cout << x << ' ';
}

Submission Info

Submission Time
Task C - Sum of Numbers Greater Than Me
User kyopro_friends
Language C++ 20 (gcc 12.2)
Score 300
Code Size 433 Byte
Status AC
Exec Time 151 ms
Memory 27452 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 21
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All hand_01.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
hand_01.txt AC 1 ms 3632 KiB
random_01.txt AC 149 ms 25244 KiB
random_02.txt AC 90 ms 17932 KiB
random_03.txt AC 145 ms 25272 KiB
random_04.txt AC 138 ms 25344 KiB
random_05.txt AC 149 ms 25332 KiB
random_06.txt AC 20 ms 6964 KiB
random_07.txt AC 134 ms 25336 KiB
random_08.txt AC 125 ms 22504 KiB
random_09.txt AC 151 ms 25336 KiB
random_10.txt AC 16 ms 6416 KiB
random_11.txt AC 26 ms 7152 KiB
random_12.txt AC 50 ms 7052 KiB
random_13.txt AC 50 ms 7088 KiB
random_14.txt AC 150 ms 27452 KiB
random_15.txt AC 151 ms 27376 KiB
random_16.txt AC 57 ms 6572 KiB
random_17.txt AC 56 ms 6668 KiB
sample_01.txt AC 1 ms 3540 KiB
sample_02.txt AC 1 ms 3560 KiB
sample_03.txt AC 1 ms 3560 KiB