Codeforces Beta Round #57 (Div. 2)E---Enemy is weak(树状数组+离散化)

YOLO26算法皮革表面缺陷检测+训练好的模型+124张数据集+pyqt可视化界面.zip 附训练好的 YOLO 权重与 PyQt 可视化检测界面,页面底部含可视化效果预览,毕设/课设开箱即用。 【数据集概况】 · 检测类别(中文):[颜色(color), 切(cut), 折叠(fold), 胶水(glue), 好的(good), 戳(poke)] 【训练曲线与评估图】 【模型训练配置】 参数 | 值 模型 | yolo26n 训练轮数 | 100 epochs 输入尺寸 | 640x640 批次大小 | 24 优化器 | auto 初始学习率 | 0.01 训练设备 【关键指标汇总】 训练了 68 个 epoch,最终轮指标: 指标 | 数值 mAP50 | **0.7582** mAP50-95 | 0.4306 Precision | 0.6226 Recall | 0.6520 train/box_loss | 0.8731 train/cls_loss | 2.3543 val/box_loss | 1.3709 val/cls_loss | 3.9767 【训练过程分析】 从一开始的配置就定下了基调,训练配置包括了 yolo26n 模型、100 个 epoch,学习率初始设为 0.01,输入尺寸定为 640x640,批次大小为 24。这组配置在开始阶段表现得不错,模型刚开始训练时的 loss 降低得很快,这表明模型能够迅速从数据中吸收信息。但到了中后期,loss 曲线变得愈发平缓,从第 50 个 epoch 开始,即使我增加了学习率衰减的频率,仍然感到曲线在挣扎,像是陷入了平台期。这期间模型的收敛节奏明显减缓,似乎有些“停滞不前”的迹象。到了最后,模型确实收敛了,但在第 68 个 epoch 时 mAP50 获得了 0.7582 的值,这是一个不错的成绩,但与理想值相比仍有提升空间。... 使用场景:毕业设计、课程设计、深度学习入门、工业场景落地验证。 立即下载

The Romans have attacked again. This time they are much more than the Persians but Shapur is ready to defeat them. He says: “A lion is never afraid of a hundred sheep”.

Nevertheless Shapur has to find weaknesses in the Roman army to defeat them. So he gives the army a weakness number.

In Shapur’s opinion the weakness of an army is equal to the number of triplets i, j, k such that i < j < k and ai > aj > ak where ax is the power of man standing at position x. The Roman army has one special trait — powers of all the people in it are distinct.

Help Shapur find out how weak the Romans are.
Input

The first line of input contains a single number n (3 ≤ n ≤ 106) — the number of men in Roman army. Next line contains n different positive integers ai (1 ≤ i ≤ n, 1 ≤ ai ≤ 109) — powers of men in the Roman army.
Output

A single integer number, the weakness of the Roman army.

Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cout (also you may use %I64d).
Sample test(s)
Input

3
3 2 1

Output

1

Input

3
2 3 1

Output

0

Input

4
10 8 3 1

Output

4

Input

4
1 5 4 3

Output

1

两次树状数组维护,第一次维护求出每一个位置上的逆序数的对数
第二次维护到目前为止,插入到树状数组上的逆序对的总数目
数据较大,离散化一下

/*************************************************************************
    > File Name: CF-57-E.cpp
    > Author: ALex
    > Mail: zchao1995@gmail.com 
    > Created Time: 2015年03月23日 星期一 21时00分16秒
 ************************************************************************/

#include <map>
#include <set>
#include <queue>
#include <stack>
#include <vector>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;

const double pi = acos(-1.0);
const int inf = 0x3f3f3f3f;
const double eps = 1e-15;
typedef long long LL;
typedef pair <int, int> PLL;

const int N = 1010000;
LL tree[N];
LL inver[N];
int val[N];
LL pre[N];
int xis[N];
int cnt;

int binsearch(int x)
{
    int l = 1;
    int r = cnt;
    int mid;
    while (l <= r)
    {
        mid = (l + r) >> 1;
        if (xis[mid] > x)
        {
            r = mid - 1;
        }
        else if (xis[mid] < x)
        {
            l = mid + 1;
        }
        else
        {
            break;
        }
    }
    return mid;
}

int lowbit(int x)
{
    return x & (-x);
}

void add(int x, int cnt)
{
    for (int i = x; i <= N; i += lowbit(i))
    {
        tree[i] += cnt;
    }
}

LL sum(int x)
{
    LL ans = 0;
    for (int i = x; i; i -= lowbit(i))
    {
        ans += tree[i];
    }
    return ans;
}

int main()
{
    int n;
    while (~scanf("%d", &n))
    {
        cnt = 0;
        LL ans = 0;
        memset(pre, 0, sizeof(pre));
        memset(inver, 0, sizeof(inver));
        memset(tree, 0, sizeof(tree));
        for (int i = 1; i <= n; ++i)
        {
            scanf("%d", &val[i]);
            xis[++cnt] = val[i];
        }
        sort(xis + 1, xis + 1 + cnt);
        cnt = unique(xis + 1, xis + 1 + cnt) - xis - 1;
        for (int i = 1; i <= n; ++i)
        {
            int x = binsearch(val[i]);
            add(x, 1);
            inver[i] = i - sum(x);
            pre[i] = pre[i - 1] + inver[i];
        }
        memset(tree, 0, sizeof(tree));
        for (int i = 1; i <= n; ++i)
        {
            int x = binsearch(val[i]);
            add(x, inver[i]);
            ans += pre[i] - sum(x);
        }
        printf("%lld\n", ans);
    }
    return 0;
}
汽车OTA安全启动:ECU双验签机制与实战排障指南 汽车OTA升级中的安全启动,本质是基于密码学的信任建立过程,其核心在于ECU上电时对固件镜像的可信验证。该机制依托硬件信任根(Secure Boot ROM),通过RSA/ECDSA等非对称算法完成签名验签,确保升级包未被篡改且来源可信。技术价值体现在防止恶意固件注入、支撑功能安全(ASIL)与信息安全(ISO/SAE 21434)合规。典型应用场景包括4S店远程升级、BMS控制器固件更新及多ECU协同启动。实践中,验签名失败往往源于证书链断裂、Flash布局错位或KeyUsage字段不匹配等底层工程细节, 阅读详情

相关推荐

推荐系统召回总结(持续更新)

推荐系统架构 候选池:可供推荐的物料候选池,对于图文、短视频、新闻等来说通常是最近N天的新物料组成的集合,定期进行物料更新。 召回:从候选池中选出和用户相关的物料,交给后面的排序模块进行打分。召回面对的候选集通常是数十万或者百万甚至千万的量级,检索过程必须轻量快速。通常由多路召回组成,保证不遗漏且相关性、多样性尽量好,可以分为非个性化召回和个性化召回。 粗排:对召回选择的几千或者几百候选物料进行排序,快速打分选出topN,减少精排的压力,兼顾精准与效率。 精排:对粗排的结果进行精准排序,这个环节需要特征尽可

whgyxy的博客 2515

Codeforces Beta Round #57 (Div. 2) Enemy is weak

E. Enemy is weak time limit per test 5 seconds memory limit per test 256 megabytes The Romans have attacked again. This time they are much more than the Persians but Shapur is ready to defeat them

ChiLuManXi的部落格 1271

AI工具如何提升产品经理工作效率

AI工具在现代产品管理中扮演着越来越重要的角色,从需求挖掘到原型设计再到交付物制作,AI技术正在重塑产品经理的工作流程。通过自然语言处理(NLP)和机器学习(ML)技术,AI工具能够自动化处理大量重复性任务,如用户访谈转录、竞品分析、原型生成等,显著提升工作效率。以ChatGPT和Notion AI为例,这些工具可以快速生成结构化分析框架和PRD初稿,将传统需要数小时甚至数天的工作压缩到几分钟内完成。在产品设计阶段,工具如Uizard和Galileo AI能够根据文本描述自动生成可交互原型,大幅缩短设计探索

weixin_29194817的博客 242

UESTC Training for Data Structures——A

Problem  A Problem Description   The Romans have attacked again,This time they are much more than the Persians but Shapue is ready to defeat them.He says:"A lion is never afraid of a hundred shee

蛤蛤~ 747

基于卷积神经网络的人脸识别算法

摘要:近年来,随着科学技术的不断发展,人脸识别技术日渐成熟,使得人脸识别技术的使用率不断增大。例如:门禁、ATM机、公安系统以及新兴起的人机交互等领域,都应用到了人脸识别系统。在人脸识别研究领域中,深度学习扮演着重要的角色。由于深度学习的人脸识别技术凭借其识别率高、识别快等特点,逐渐成为整个领域的主流技术。在众多深度学习算法中,以卷积神经网络为代表的人脸识别系统得到了广泛应用,主要研究内容如下:首先,通过对经典损失函数进行研究,对比每种损失函数的特点,然后根据A-Softmax函数进行改进,借助Margin

yyq2263511327的博客 1万+

Win11下WSL2安装Ubuntu22.04避坑指南:从镜像源到C++环境配置

本文提供了一份详细的Win11下WSL2安装Ubuntu22.04的实战避坑指南。内容涵盖从WSL2核心安装、自定义安装路径,到更换国内镜像源以解决更新缓慢问题,并一站式配置完整的C++开发环境(包括GCC、CMake、vcpkg等),最后分享提升开发体验的进阶技巧,助你在Windows上打造高效的Linux开发工作站。

weixin_29260291的博客 562

关于codeforces比赛规则介绍(转载)

Codeforces 简称: cf(所以谈论cf的时候经常被误会成TX的那款游戏). 网址: codeforces.com   这是一个俄国的算法竞赛网站,由来自萨拉托夫州立大学、由Mike Mirzayanov领导的一个团队创立和维护,是一个举办比赛、做题和交流的平台.举办比赛和做题就不说了,“交流”指的是自带blog功能,可以求助/发布题解之类.官方语言是俄语和英语,因此可能有些偏僻的题...

一个AFO的蒟蒻 6897

一文速览:大模型语料构建与基础训练全流程实战指南

因为模型只有看到足够丰富、高质量的数据,才能真正学到“真本事”,展现出更强大的泛化能力,也就是能够在全新的场景和任务下,做出准确的推理和判断。我们日常做饭的时候,通常会先把买回来的菜仔细清洗干净,把坏掉的叶子、泥土、杂质等去除掉。同理,训练大模型的数据就像我们的食材,如果不干净,就会影响模型的学习效果,甚至训练出逻辑紊乱的模型。在大模型的世界里,有一句名言:“Garbage in, Garbage out”,翻译过来就是“垃圾输入,垃圾输出”,说白了,就是给模型喂的是什么数据,它学到的就是什么知识。

master_hunter的博客 1671

Codeforces Beta Round #57 (Div. 2) E. Enemy is weak

题目: 题意:

Halo 916

网口通信实战(C#完整版):基于TCP协议的工业仪表数据采集系统开发

工业现场中80%的智能仪表(压力/温度/液位/流量/数显仪表)、采集模块、测控终端均支持TCP网口通信,这类设备的TCP通信有鲜明的工业特性:基于字节流的自定义二进制协议、一问一答的主从通信模式、对数据完整性/稳定性要求极高。本次实战是纯工业级落地项目,基于C# WinForm + .NET Framework 4.8(工业上位机标配)✅纯原生无依赖:零第三方类库/控件,仅用C#原生,源码可100%复用、无引用冲突、工控机完美兼容;✅双采集模式完美适配:同时实现「单次手动采集」+「连续自动采集」

这里只有干货:从 Modbus 通信到 MES 对接,从 YOLO 训练到工控机部署,带你搞定工业软件开发全流程。 1802

手把手教你学 MATLAB 实战训练(6.5):基础实战实例

MATLAB 是一款强大的数学软件,广泛应用于工程计算、信号处理、控制系统设计、图像处理等领域。学习 MATLAB 不仅可以提高你的编程技能,还能帮助你解决实际的数学和工程问题。下面我将通过几个实战训练实例来教你如何使用 MATLAB。

xiaoheshang_123的博客 367

hdu5172---GTY's gay friends

Problem Description GTY has n gay friends. To manage them conveniently, every morning he ordered all his gay friends to stand in a line. Every gay friend has a characteristic value ai , to express how

Alex 1850

5步上手Quartz.NetUI:.NET Core定时任务的开箱即用解决方案

Quartz.NetUI是一个基于.NET Core + Quartz.NET + Vue + IView的开箱即用的定时任务UI解决方案。它结合了Quartz.NET的强大功能和Vue.js的易用性,提供了一个不依赖数据库、只需在界面进行简单配置即可使用的定时任务管理系统。通过上述步骤,你已经学会了如何使用Quartz.NetUI在.NET Core项目中实现定时任务。Quartz.NetUI不仅功能强大,而且使用简单,非常适合那些需要快速实现定时任务管理的开发者。

java专栏 2407

hdu5141——LIS again

LIS again Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 132    Accepted Submission(s): 34 Problem Description A numeric sequence of a

Alex 1773

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

Codeforces Round #291 (Div. 2)---C. Watto and Mechanism

Watto, the owner of a spare parts store, has recently got an order for the mechanism that can process strings in a certain way. Initially the memory of the mechanism is filled with n strings. Then the

Alex 1642

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

POJ2029——Get Many Persimmon Trees

Get Many Persimmon Trees Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 3656   Accepted: 2378 Description Seiji Hayashi had been a professor of the Nisshinkan

Alex 1271

文档:亲测可用解决vnc灰屏,黑屏,鼠标大黑叉情况

主要解决vnc-viewer灰屏,黑屏,鼠标大黑叉等现象,详细见文档。

hdu3607——Traversal

Traversal Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 1038    Accepted Submission(s): 365 Problem Description Xiao Ming is travelli

Alex 1270

hdu2275——Kiki & Little Kiki 1

Kiki & Little Kiki 1 Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 873    Accepted Submission(s): 283 Problem Description Kiki is con

Alex 1257

POJ2492---A Bug's Life

A Bug's Life Time Limit: 10000MS   Memory Limit: 65536K Total Submissions: 29209   Accepted: 9528 Description Background Professor Hopper is researching the sexual behavio

Alex 1252

Codeforces Round #170 (Div. 2)---C. Learning Languages(并查集)

The “BerCorp” company has got n employees. These employees can use m approved official languages for the formal correspondence. The languages are numbered with integers from 1 to m. For each employee w

Alex 1238

Codeforces Round #172 (Div. 2)---D. Maximum Xor Secondary(RMQ + 二分)

Bike loves looking for the second maximum element in the sequence. The second maximum element in the sequence of distinct numbers x1, x2, …, xk (k > 1) is such maximum element xj, that the following in

Alex 1221

sdut2610---Boring Counting(离线+树状数组+离散化)

Boring Counting Time Limit: 3000ms Memory limit: 65536K 有疑问?点这里^_^ 题目描述 In this problem you are given a number sequence P consisting of N integer and Pi is the ith element in the sequence. No

Alex 1187

hdu4719——Oh My Holy FFF

Oh My Holy FFF Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 65535/65535 K (Java/Others) Total Submission(s): 626    Accepted Submission(s): 147 Problem Description N soldiers from t

Alex 1163

POJ1177----Picture

Picture Time Limit: 2000MS   Memory Limit: 10000K Total Submissions: 10727   Accepted: 5662 Description A number of rectangular posters, photographs and other pictures of t

Alex 1125

Codeforces Round #225 (Div. 2)---E. Propagating tree(时间戳+线段树)

Iahub likes trees very much. Recently he discovered an interesting tree named propagating tree. The tree consists of n nodes numbered from 1 to n, each node i having an initial value ai. The root of th

Alex 1123

Codeforces Beta Round #75 (Div. 1 Only)---B.Queue

There are n walruses standing in a queue in an airport. They are numbered starting from the queue’s tail: the 1-st walrus stands at the end of the queue and the n-th walrus stands at the beginning of t

Alex 1120
上一篇: VK Cup 2015 - Round 1 (unofficial online mirror, Div. 1 only)E---The Art of Dealing with ATM
下一篇: Codeforces Beta Round #75 (Div. 1 Only)---B.Queue
tokers
博客等级 码龄12年 71粉丝 700原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值