poj 1990 MooFest (树状数组)

1000Base-T1协议解读(基于802.3bq-2016 和Test Suite) 1000Base-T1是由一对双绞线实现全双工传输的以太网标准,采用PAM3编码方式(-1,0,1),编码后的实际传输符号速率为750Mbps。该标准的车载最大传输距离可达15米,主要应用于汽车产品开发过程。测试过程示波器要求带宽≥2G,采样率≥7.5Gbps,网分带宽≥1G。 阅读详情

MooFest

Time Limit: 1000MS Memory Limit: 30000K

Description

Every year, Farmer John’s N (1 <= N <= 20,000) cows attend “MooFest”,a social gathering of cows from around the world. MooFest involves a variety of events including haybale stacking, fence jumping, pin the tail on the farmer, and of course, mooing. When the cows all stand in line for a particular event, they moo so loudly that the roar is practically deafening. After participating in this event year after year, some of the cows have in fact lost a bit of their hearing.

Each cow i has an associated “hearing” threshold v(i) (in the range 1..20,000). If a cow moos to cow i, she must use a volume of at least v(i) times the distance between the two cows in order to be heard by cow i. If two cows i and j wish to converse, they must speak at a volume level equal to the distance between them times max(v(i),v(j)).

Suppose each of the N cows is standing in a straight line (each cow at some unique x coordinate in the range 1..20,000), and every pair of cows is carrying on a conversation using the smallest possible volume.

Compute the sum of all the volumes produced by all N(N-1)/2 pairs of mooing cows.

Input

  • Line 1: A single integer, N

  • Lines 2..N+1: Two integers: the volume threshold and x coordinate for a cow. Line 2 represents the first cow; line 3 represents the second cow; and so on. No two cows will stand at the same location.

Output

  • Line 1: A single line with a single integer that is the sum of all the volumes of the conversing cows.

Sample Input

4
3 1
2 5
2 6
4 3

Sample Output

57


嗯……题目先贴出来,改天再写思路……
代码如下:

#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#define INF 0x3f3f3f3f
#define mem(x,val) memset(x,val,sizeof(x))
#define SI(x) scanf("%d",&x)
#define MAX 20000+10

using namespace std;
typedef long long ll;

struct cow{
    int v,x;
}c[MAX];

int t1[MAX],t2[MAX],s[MAX];
int lowbit(int x)
{
    return x&(-x);
}

void update(int pos,int v,int t[],int n)
{
    while(pos<=n)
    {
        t[pos]+=v;
        pos+=lowbit(pos);
    }
}

int sum(int pos,int t[])
{
    int ans=0;
    while(pos>0)
    {
        ans+=t[pos];
        pos-=lowbit(pos);
    }
    return ans;
}

bool cmp(cow x,cow y)
{
    return x.v<y.v;
}
int main()
{
    int n,i;
    while(SI(n)!=EOF)
    {
        ll msum=0;
        ll lessx,morex,lessnum,morenum;
        int max_x=0;
        for(i=1;i<=n;i++)
            scanf("%d%d",&c[i].v,&c[i].x);
        sort(c+1,c+n+1,cmp);
        mem(t1,0);
        mem(t2,0);
        mem(s,0);
        for(i=1;i<=n;i++)
        {
            s[i]=s[i-1]+c[i].x;
            max_x=max(c[i].x,max_x);
        }
        for(i=1;i<=n;i++)
        {
            update(c[i].x,c[i].x,t1,max_x);
            update(c[i].x,1,t2,max_x);
            lessnum=sum(c[i].x-1,t2);
            lessx=sum(c[i].x-1,t1);
            morenum=i-1-lessnum;
            morex=s[i-1]-lessx;
            msum+=(c[i].x*lessnum-lessx+morex-c[i].x*morenum)*c[i].v;
        }
        printf("%lld\n",msum);
    }
    return 0;
}
ICC2:使用analyze_lib_cell_placement检查lib cell的pass rate 我正在「拾陆楼」和朋友们讨论有趣的话题,你⼀起来吧?在place之前需要使analyze_lib_cell_placement命令去检查lib cell在当前的site row/power plan/legalize设置的环境下能够正常place和legalize。下面分享一个脚本去报告pass rate低于2%的lib cell。 阅读详情

相关推荐

DDS信号发生器设计避坑指南:从AD9834配置到巴特沃斯滤波实战

本文详细解析了基于AD9834芯片的DDS信号发生器设计中的关键技术要点与常见陷阱,涵盖时钟源选择、寄存器配置时序、巴特沃斯滤波器设计等核心内容。针对中高频段信号质量优化,提供了实用的解决方案和代码示例,帮助工程师规避设计误区,提升信号发生器的性能和稳定性。

2y3u4i5o6p的博客 782

POJ 1990 MooFest

POJ 1990

ACdream 403

Keil中搭建自动化单元测试框架Unity

前言:   虽然一些C++的自动化单元测试框架也能用来C语言单元测试,但那样我们编写C语言程序时需要符合C++的标准,这样有一些C的特性是无法使用的,限制C的特性使用不太好,于是找了一个全部用C实现的自动化测试框架。Unity是一个简单且直接的自动化单元测试框架,它由很少的几个文件构成。 搭建环境:   1.从github上下载最新版本的Unity源码,下载链接:https://github...

程序员的自我修炼 3900

POJ 1990 (树状数组入门)

MooFest Every year, Farmer John’s N (1 <= N <= 20,000) cows attend “MooFest”,a social gathering of cows from around the world. MooFest involves a variety of events including haybale stacking, fe...

c___c18的博客 364

ZYNQ Linux 应用层 利用 AXI DMA 进行数据传输

ZYNQ Linux应用层 利用 AXI DMA 进行数据传输 软件版本: VIVADO2018.2 操作系统: Debian 9 硬件平台: ZYNQ-MZ7100FA 嵌入式操作系统:Debian(4.19.0-xilinx) AXI-DMA驱动:GitHub:bperez77/xilinx_axidma 一、搭建硬件环境 参见:《ZYNQ 修炼秘籍裸机篇 2019 版》第21章:CH21 利用 AXI DMA 进行批量数据环路测试 参考文章: ZYNQ跑系统 系列(四) AXI-DMA的linux下运

jin787730090的博客 1万+

Orcad 17.2导出PDF原理图终极指南:从Ghostscript安装到带属性书签配置

本文是Orcad 17.2导出高质量PDF原理图的终极指南。针对导出过程中常见的Ghostscript安装报错、软件卡死及版本兼容性问题,提供了详细的解决方案。重点推荐使用Ghostscript 9.53.3版本以确保最佳兼容性,并深入讲解了从安装配置、内存优化到高级书签属性设置的完整流程,帮助硬件工程师稳定、高效地生成带完整器件属性和导航书签的PDF文档。

weixin_29281915的博客 397

POJ1990 题解

题目大意: 思路: 代码: //POJ.1990 //Author: Prgl //06-11-2021 23:44:04(UTC+8) #include<bits/stdc++.h> using namespace std; #define IOS ios::sync_with_stdio(0),cin.tie(0),cout.tie(0) typedef long long ll; typedef pair<int, int>P; typedef vector<i

Prgl的博客 446

YOLOv8改进 | Conv篇 | DWRSeg扩张式残差助力小目标检测 (附修改后的C2f+Bottleneck)

本文内容给大家带来的DWRSeg中的DWR模块来改进YOLOv8中的C2f和Bottleneck模块,主要针对的是小目标检测,主要创新点可以总结如下:多尺度特征提取机制的深入研究和创新的DWR模块和SIR模块的提出这种方法使得网络能够更灵活地适应不同尺度的特征,从而更准确地识别和分割图像中的物体。通过本文你能够了解到DWRSeg的基本原理和框架,并且能够在你自己的网络结构中进行添加(DWRSeg需要增加一定的计算量一个DWR模块大概增加0.4GFLOPs)。

Snu77的博客 9572

POJ - 1990 (MooFest)

题意:n 头牛,每头牛有两个属性值 耳聋程度 w 和坐标 x ( x保证互不相同 ),两头牛i,j可以联系的最低代价是 abs(xi-xj)*max(wi,wj),求所有牛相互联系的最低代价总和; 分析:按照耳聋程度从小到大排序,那么每加进一头牛,它的耳聋程度是最大的,即: 那么问题就转化成每一次加进一头牛如何求它与之前所有牛的距离和,到这个点,区间维护的问题,应该可以想到用线段树...

Joker & Liar的博客 490

15张图详解三方支付:总架构、5大核心业务处理流程、备付金管理

用户可以将银行卡与零钱账户绑定,建立银行结算账户与支付账户的连接,然后将银行账户资金充值到零钱账户中,或将零钱账号中的余额提现至绑定的银行卡。因此,用户在A支付机构的零钱一般只能支付给A支付机构的商户,如支付宝的零钱不能支付给微信的商户。这五大业务的协同运作,使得第三方支付机构这一庞大的支付服务平台能够为市场提供卓越的支付能力。到了结算时间,网联会向备付金集中存管账户提交结算指令,在第三方支付机构备付金集中存管账户内完成最终的结算,并将结算结果及额度变动情况通知给第三方支付机构,具体流程如图13所示。

银行信息系统应用架构详解 1044

Unity-Mirror网络框架-从入门到精通之Mirror简介

在现代游戏开发中,网络功能日益成为提升游戏体验的关键组成部分。Mirror是一个用于Unity的开源网络框架,专为多人游戏开发设计。它使得开发者能够轻松实现网络连接、数据同步和游戏状态管理。本文将深入介绍Mirror的基本概念、如何与其他网络框架进行比较,以及如何从零开始创建一个使用Mirror的简单网络项目。Mirror是一个功能强大的Lite网络框架,旨在替代Unity的UNet网络解决方案。它提供了高效的多玩家架构、简单易用的API,以及良好的社区支持。

TxNet 3094

POJ - 1990 MooFest

Every year, Farmer John's N (1 <= N <= 20,000) cows attend "MooFest",a social gathering of cows from around the world. MooFest involves a variety of events including haybale stacking, fence jump...

Ven 289

【FPGA教程案例89】编译码2——使用vivado核实现RS信道编译码

RS编码,又称里所码,即Reed-solomon codes,是一种前向纠错的信道编码,对由校正过采样数据所产生的多项式有效。当接收器正确的收到足够的点后,它就可以恢复原来的多项式,即使接收到的多项式上有很多点被噪声干扰失真。

FPGA/MATLAB学习教程/源码/项目合作开发 3542

poj 1990 MooFest // 树状数组

poj 1990 MooFest // 树状数组 Time Limit:1000MS Memory Limit:30000K Total Submissions:10281 Accepted:4702 Description Every year, Farmer John's N (1 <= N <= 20,000) cows at...

Rshs 225

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

POJ1990 MooFest 树状数组 题解(附图)

MooFest Time Limit: 1000MS   Memory Limit: 30000K Total Submissions:9207   Accepted: 4167 Description Every year, Farmer John's N (1 &lt;= N &lt;= 20,000) cows attend "MooFest",a soc...

bestsort 936

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

POJ - 1990 MooFest(树状数组)

POJ-1990 MooFest 题目链接 题意: 每头牛 iii 都有自己的位置 xix_ixi​ 和听力上限 viv_ivi​ ,如果 两头牛 iii 和 jjj 想要交流,假设 xi<xjx_i<x_jxi​<xj​ ,需消耗 (xj−xi)×max(vi,vj)(x_j-x_i) \times max(v_i,v_j)(xj​−xi​)×max(vi​,vj​) 这些能...

NaNa 305

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

POJ 1990 MooFest 树状数组

题目来源:POJ 1990 MooFest 题意:就算每两头牛之间声音值 2头牛v的最大值*2头牛之间的距离 思路:按照v从小到大插入树状数组 每插入一头牛i 统计x比他小的个数s1 x比他大的个数s2 x比他小的距离l1 x比他大的距离l2 求和 #include #include #include using namespace std; const int maxn = 2001

嗯。 1025

POJ - 1990 MooFest 树状数组

  POJ - 1990 MooFest 题意: 给定 n 头牛的 听力阈值 和 所在位置,第 i 头牛和第 j 头牛相互交流所需的最小值为 max(Vi,Vj)*(Xi-Xj)。求所有牛相互交流的总和。 思路: 将牛的听力阈值降序排列。计算时当前牛的听力阈值即为最大所以只需求出 距离和牛数 就能算出当前牛到其他已经存在树状数组中牛的的总和,并更新。 这里用到两个树状数组 #incl...

没有梦想何以远行 224

POJ 1990 MooFest (树状数组)

每年,农夫约翰的N(1 每个奶牛具有耳背值v(i)(在1..20,000的范围内)。如果一头牛向牛i吼叫,她必须使用至少是两头母牛之间距离的v(i)倍的声音,以便被牛i听到。如果两个奶牛i和j想要交谈,她们必须以等于她们之间的距离乘以max(v(i),v(j))的音量说话。  假设N头奶牛中的每头奶牛都站在直线上(每头奶牛在1..20,000范围内的某个独特x坐标),每对奶牛都使用尽

Interstellar_的博客 999

POJ 1990 MooFest(树状数组+离线处理)

POJ1990 MooFest(树状数组+离线处理) 分析: 因为要求max(vi,vj),所以先读入所有的牛,将牛按它的vi值从小到大排序,所以当前处理的牛总是vi值最大的。 接下来就要算当前第i头牛的坐标xi和之前出现的所有牛的坐标之差的总和了。维护两个树状数组,数组1的sum(1,x)表示的是坐标值 那么假设当前处理第i头牛,维护当前已经处理了的所有牛的坐标和total,并执行:ad

code 1372

POJ 1990 MooFest(树状数组好题)

题目链接: http://poj.org/problem?id=1990 题意: 给定nnn个奶牛,每个奶牛有两个权值,第一个pospospos表示位置,每个点的pospospos均不相同,第二个表示valvalval表示奶牛声音传播属性,对于两个奶牛(x,y)(x,y)(x,y)之间的交流有一个结果,值等于∣posx−posy∣\left| pos_x-pos_y\right|∣posx​−po...

梧桐 249

POJ 1990 MooFest(树状数组)

MooFest Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 6968   Accepted: 3132 Description Every year, Farmer John's N (1 <= N <= 20,000) cows attend "MooFest

MR CODER 349

POJ 1990 MooFest 【树状数组】

MooFest Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 6056   Accepted: 2669 Description Every year, Farmer John's N (1 <= N <= 20,000) cows attend "MooFest",

wyjwyl的专栏 487

POJ1990 MooFest,树状数组

树状数组经典题,翻了一下别的解题报告,都是大同小异解释的不清楚,详情可以看我代码中的注释 /******************************************************************************* # Author : Neo Fung # Email : neosfung@gmail.com # Last modified:

Neo Fung的专栏 1273

POJ1990-MooFest(树状数组)

MooFest 题意:有n头牛,每头牛有两个属性,音量v,在X轴上的坐标x。牛i牛_i牛i​和牛j牛_j牛j​想要通话,音量至少是max(vi,vj)∗abs(xi−xj)max(v_i, v_j) * abs(x_i - x_j)max(vi​,vj​)∗abs(xi​−xj​),要求每对牛通话音量的和。 思路: 暴力做法就是∑i=0n∑j=0i−1(max(vi,vj)∗abs(xi−xj))\sum_{i=0}^n\sum_{j=0}^{i-1}(max(v_i, v_j) * abs(x_i - x

weixin_45363113的博客 239

POJ 1990 MooFest(树状数组)

MooFest Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 5395   Accepted: 2329 Description Every year, Farmer John's N (1 <= N <= 20,000) cows attend "MooFest",

ACway的专栏 1291
上一篇: poj 3468 A Simple Problem with Integers
下一篇: hdu 5495 Fxx and game(dp+单调队列优化)
ciel_s
博客等级 码龄11年 18粉丝 51原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值