Logo huzhenyuan的博客

博客

新博客

2026-07-03 15:59:00 By huzhenyuan

神秘

#include <cstdio>
#include <vector>
#include <algorithm>
#include <queue>

using std::printf;
using std::scanf;
using std::vector;
using std::pair;

int main()
{
    int t, n;
    long long ans;
    vector<pair<pair<int, int>, int>> a;
    vector<std::priority_queue<int, vector<int>, std::greater<int>>> pq;
    scanf("%d", &t);
    while (t-- > 0)
    {
        ans = 0;
        scanf("%d", &n);
        //a.clear();
        //pq.clear();
        a.resize(n);
        pq.resize(3, std::priority_queue<int, vector<int>, std::greater<int>>());
        for (int i = 0; i < n; i++)
        {
            int a1, a2, a3;
            scanf("%d %d %d", &a1, &a2, &a3);
            if (a1 > a2)
                if (a1 > a3)
                {
                    a[i].first.first = 0;
                    a[i].first.second = a1;
                    a[i].second = a2 > a3 ? a2 : a3;
                }
                else
                {
                    a[i].first.first = 2;
                    a[i].first.second = a3;
                    a[i].second = a1;
                }
            else
                if (a2 > a3)
                {
                    a[i].first.first = 1;
                    a[i].first.second = a2;
                    a[i].second = a1 > a3 ? a1 : a3;
                }
                else
                {
                    a[i].first.first = 2;
                    a[i].first.second = a3;
                    a[i].second = a2;
                }
            ans += a[i].first.second;
            pq[a[i].first.first].push(a[i].first.second - a[i].second);
        }
        for (int i = 0; i < 3; i++)
            for (int j = n >> 1; j < pq[i].size(); j++)
            {
                ans -= pq[i].top();
                pq[i].pop();
            }
        printf("%lld\n", ans);
    }
    return 0;
}

Tree.hpp V2.2

2026-01-25 18:30:44 By huzhenyuan

Tree.hpp V2.2

Q: 为什么更这么慢啊?

A: 不到啊

不管了,反正能用

(其实std::Tree用不了)

把Tree_node修了一下,自己试试

阅读更多……

Thanks to GCC

2026-01-10 10:43:37 By huzhenyuan

What's this?

(root_dir = file_dir)

g++.exe -c (file_name) -std=c++11 -I".\MinGW64\include" -I".\MinGW64\x86_64-w64-mingw32\include" -I".\MinGW64\lib\gcc\x86_64-w64-mingw32\4.8.1\include" -L".\MinGW64\lib" -L".\MinGW64\x86_64-w64-mingw32\lib"

链接这一块

Tree.hpp V2.1

2025-11-22 12:59:55 By huzhenyuan

Tree.hpp--V2.0!!!

2025-10-16 00:06:34 By huzhenyuan

Tree.hpp V2.0!!!

连夜|加工……

不解释,自己看吧……

(告诉你们把,就是可以使用自定义数据类型来保存子节点了)

阅读更多……

huzhenyuan Avatar