/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Wrong Answer 29ms 532.0 KiB
#3 Wrong Answer 28ms 576.0 KiB

Code

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

int main(){
    ios :: sync_with_stdio(false);
    cin.tie(0);

    int tc;
    cin>>tc;
    while(tc--){
        int n;
        cin>>n;
        vector<int>v(n);
        for(auto &it:v){
            cin>>it;
        }
        sort(v.rbegin(),v.rend());
        int ans = 0;
        for(int i=0;i<n-2;i+=3){
            ans += (v[i] * v[i+1] * v[i+1]);
        }
        cout<<ans<<endl;
    }
}

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:19:30
Judged At
2025-01-02 15:19:30
Judged By
Score
1
Total Time
29ms
Peak Memory
576.0 KiB