/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Wrong Answer 13ms 576.0 KiB
#3 Wrong Answer 23ms 532.0 KiB

Code

// Author: Mushfiq R.
#include <bits/stdc++.h>
#define endl "\n"
#define rsort(v) sort(v.begin(), v.end(), greater<int>())
#define fastIO() (ios_base::sync_with_stdio(false), cin.tie(NULL));
using namespace std;

int main()
{
    fastIO();
    int t = 1;
    cin >> t;
    while (t--)
    {
        int n;
        cin >> n;

        vector<int> arr(n);

        for (int i = 0; i < n; i++)
        {
            cin >> arr[i];
        }

        rsort(arr);

        int sum = 0;
        for (int i = 0; i < n / 3; i++)
        {
            sum += arr[i] * arr[i + 1] * arr[i + 2];
        }

        cout << sum << endl;
    }

    return 0;
}

Information

Submit By
Type
Submission
Problem
P1152 Special Array
Contest
Happy New Year 2025
Language
C++17 (G++ 13.2.0)
Submit At
2025-01-02 15:26:19
Judged At
2025-01-02 15:26:19
Judged By
Score
1
Total Time
23ms
Peak Memory
576.0 KiB