Educational Codeforces Round 3 609C Load Balancing(脑洞)

跨模态行人重识别实战:Python复现SYSU-MM01官方评估协议 本文详细介绍了如何用Python复现SYSU-MM01数据集的官方评估协议,以解决原Matlab代码在Python生态中不便使用的问题。文章深入解析了数据集的`indoor`与`all`两种评估模式,并提供了完整的Python代码实现,包括特征加载、相似度计算、Rank-k与mAP指标计算等核心步骤,确保评估结果与官方Matlab版本完全一致,助力跨模态行人重识别研究。 阅读详情

C. Load Balancing
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

In the school computer room there are n servers which are responsible for processing several computing tasks. You know the number of scheduled tasks for each server: there are mi tasks assigned to the i-th server.

In order to balance the load for each server, you want to reassign some tasks to make the difference between the most loaded server and the least loaded server as small as possible. In other words you want to minimize expression ma - mb, where a is the most loaded server and b is the least loaded one.

In one second you can reassign a single task. Thus in one second you can choose any pair of servers and move a single task from one server to another.

Write a program to find the minimum number of seconds needed to balance the load of servers.

Input

The first line contains positive number n (1 ≤ n ≤ 105) — the number of the servers.

The second line contains the sequence of non-negative integers m1, m2, ..., mn (0 ≤ mi ≤ 2·104), where mi is the number of tasks assigned to the i-th server.

Output

Print the minimum number of seconds required to balance the load.

Sample test(s)
input
2
1 6
output
2
input
7
10 11 10 11 10 11 11
output
0
input
5
1 2 3 4 5
output
3
Note

In the first example two seconds are needed. In each second, a single task from server #2 should be moved to server #1. After two seconds there should be 3 tasks on server #1 and 4 tasks on server #2.

In the second example the load is already balanced.

A possible sequence of task movements for the third example is:

  1. move a task from server #4 to server #1 (the sequence m becomes: 2 2 3 3 5);
  2. then move task from server #5 to server #1 (the sequence m becomes: 3 2 3 3 4);
  3. then move task from server #5 to server #2 (the sequence m becomes: 3 3 3 3 3).

The above sequence is one of several possible ways to balance the load of servers in three seconds.



题目链接:点击打开链接

n台服务, 任意一台服务器可在一秒内将自己任务减一转移给其他服务器, 问几秒后可以使得max - min最小.

由大到小对任务量进行排序, 考虑任务合sum是否可以整除n, 若可以整除, 直接计算与平均数的差值即可. 否则, 多出来的数要计算与

(ave + 1)的差值, 因为这些大的任务与最小任务差值必然为1, 其他数计算与ave的差值.

AC代码:

#include "iostream"
#include "cstdio"
#include "cstring"
#include "algorithm"
#include "queue"
#include "stack"
#include "cmath"
#include "utility"
#include "map"
#include "set"
#include "vector"
#include "list"
#include "string"
#include "cstdlib"
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const int MAXN = 1e5 + 5;
int n, a[MAXN], sum, ans;
bool cmp(int a, int b)
{
    return a > b;
}
int main(int argc, char const *argv[])
{
    scanf("%d", &n);
    for(int i = 0; i < n; ++i) {
        scanf("%d", &a[i]);
        sum += a[i];
    }
    sort(a, a + n, cmp);
    int ave = sum / n;
    if(sum % n) {
        for(int i = 0; i < sum % n; ++i)
            if(a[i] >= ave + 1) ans += a[i] - (ave + 1);
        for(int i = sum % n; i < n; ++i)
            if(a[i] >= ave) ans += a[i] - ave;
    }
    else {
        for(int i = 0; i < n; ++i)
            if(a[i] > ave) ans += a[i] - ave;
            else break;
    }
    printf("%d\n", ans);
    return 0;
}


【无机纳米材料科研制图——OriginLab 0205】Origin对BET吸附/脱附曲线及孔径分布制图... 此篇,我们来分享如何对BET数据进行处理和制图。 一、等温吸脱附曲线绘制 1)找到等温吸脱附文件。 一半来说,对一个样品测一次BET,会产生很多数据,具体因仪器而异。我这里的数据主要有两个文件夹,一个脱附,一个吸附,吸附文件夹中多了一个等温吸脱附的文件夹。而这... 阅读详情

相关推荐

monocle使用sct整合数据integration还是rna中的counts数据 轨迹分析 拟时序

【代码】monocle使用sct整合数据integration还是rna中的counts数据 轨迹分析 拟时序。

生信小博士的博客 1049

Codeforces 609C Load Balancing 【水题】

C. Load Balancing time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output In the school computer room there are n s

世界很大 977

StarUML最新版汉化与破解二合一教程:5分钟搞定永久使用

本文提供StarUML最新版的高效使用指南,涵盖从安装到深度定制的全流程优化方案。包括软件获取最佳实践、界面个性化设置、核心建模技巧、团队协作策略及性能优化建议,帮助架构师和开发团队提升UML建模效率。特别推荐版本控制集成和文档自动化输出方案,适用于各类规模的项目开发。

weixin_42530732的博客 450

Educational Codeforces Round 3 C.Load Balancing(模拟)

大致思路:每个服务器平分任务量,不够平分的按次序给每个服务器多一个任务即可 刚开始直接模拟,总WA,最后看到大家都是算出所需移动的任务的二倍,这样简单多了

idealism_xxm的专栏 772

DELL服务器BIOS下配置RAID阵列

dell服务器配置raid阵列

weixin_58250887的博客 1万+

Python对接海康威视机器视觉工业相机

工业相机只允许单条连接,也就是说MVS如果连接了相机,python代码就无法获取数据,此时必须。相机工具类(读者直接复制)HKCamera_class.py。博主这里出现了一个警告:获取不到相机参数。四、使用Pycharm打开Python代码示例文件夹。三、找到MVS示例代码(代码在MVS的安装位置)二、解压并安装MVS客户端。一、下载MVS客户端。安装一下opencv。

Good Luck 2万+

CodeForces 609 C. Load Balancing(水~)

Description 有n台服务器,每台服务器需要处理ai个任务,每秒可以将一台服务器的一个任务转到另一台服务器执行,现要求每台服务器处理任务的最大值和最小值之差最小,问最少需要几秒来转移任务 Input 第一行为一整数n表示服务器数量,之后n个整数ai表示每台服务器要执行的任务数(1<=n<=10^5,0<=m<=2*10^4) Output 输出最少需要多少秒来转移任务才能使得服务器

ZSQ 711

Unity调用手机摄像头避坑指南:从权限检测到自动对焦问题解决

本文深入解析了Unity移动端集成手机摄像头时遇到的权限、对焦与性能等核心难题。针对权限管理,提供了健壮的原生接口调用方案;针对自动对焦模糊问题,详细对比了原生插件与第三方插件两种解决路径;并分享了分辨率选择、数据处理及功耗控制等关键性能优化技巧,帮助开发者构建稳定高效的摄像头功能。

weixin_29007243的博客 470

Educational Codeforces Round 93 (ABCD题解)

A 题意: 给你一个递增的有序数组,问你是否存在一种情况(在这个数组里选三个数,使这三个数不可以构成三角形)。若存在,输出三个数得下标,否则输出-1。 思路:贪心,直接考虑极限情况a[1],a[2],a[n]是否满足条件即可,因为此时不满足即一定不会有满足条件得情况出现。 B 题意: Alice 和 Bob 玩游戏,给他们一个只包含 1 和 0 得字符串 ,他们轮流操作,Ali...

qq_43559193的博客 802

【Unity3D】关于unity中spriteAtlas的打包方案及使用时内存状态的多组对照实验

unity项目中使用精灵(Sprite)为了降低性能消耗,我们可以使用精灵图集(Sprite Atlas)技术,它能够将多个纹理合并成一个大纹理

云渊寒烬 5100

AUTOSAE软件配置-达芬奇( DaVinci Configurator)从新建工程开始

方法1,直接使用案例工程,一般SIP包会有一个创建好的案例工程,在这样的路径YOUR_SIP_DIR/Applications/SipAddon/StartApplication下面直接打开这个*.dpa文件即可看到已经预先做好的工程:但是,这个也不是全的,也不一定完全正确,至少MCAL是没有配置好的(MCAL是IC厂商提供的,并不归属SIP包的一部分)。这样就需要你自己去配置你想要的模块,修改里面的错误。

m0_49148264的博客 2937

Educational Codeforces Round 93

A、B、C、D四道题题解 一.A题 A题题目链接 (1)题意: 有t组测试数据,每组测试数据有n个数,且这n个数按升序输入,问这组数据里面能不能选出三个数,使他们不能凑成三角形,能就输出三个数的位置,不能就输出-1。 (2)题解: 三角形的特性是两边之和大于第三边,两边之差小于第三边。 所以我们直接判断最大的差与剩下最小的数的关系,即a[n] - a[1]与a[2]的关系,假如a[n] - a[1] < a[2]的话,说明这n个数的差距不大,并不能出现两边之差大于等于第三边,两边之和小于等于第三边的情

weixin_45843077的博客 262

PCL 逐点插入法构建Delaunay三角网(C++详细过程版)

点云构建Delaunay三角网的逐点插入法基于PCL点云库的C++详细过程版实现

点云侠的博客 2991

Codeforces Educational Codeforces Round 3 C. Load Balancing 贪心

C. Load Balancing 题目连接: http://www.codeforces.com/contest/609/problem/C Description In the school computer room there are n servers which are responsible for processing several computing tasks. You kn...

weixin_30767921的博客 97

深度学习工具包 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&#39;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(&#39;DeepLearnToolbox&#39;));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(&#39;state&#39;,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&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,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 = &#39;sigm&#39;;%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, &#39;Too big error&#39;);```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(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;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)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;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, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% 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&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 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, &#39;Too big error&#39;);```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(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % 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, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % 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, &#39;Too big error&#39;);%% 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(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % 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, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

负载均衡( Load Balancing )

不记得是在哪里听到的了,大意是这样:应用系统很多问题都是通过增加一个中间层来解决的,这个中间层可以是软件的,可以是硬件的,可以是逻辑的,可以是物理的。早期的系统架构多为C/S双层架构,通过增设中间件服务器,提升整体系统的灵活性和灵活性。早期的系统集成多为点对点的对接,通过增设企业服务总线(ESB),提升集成的灵活性、复用性。等等...负载均衡( Load Balancing )也是一项中间层技术(

田攀的日志 4982

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

609C Load Balancing

题意: ”平均数“的意思是:最大数和最小数之间的差值为0或1; 先求“平均”数组,再相减。 1 #include<iostream> 2 #include<cstdlib> 3 #include<cstdio> 4 #include<algorithm> 5 #include<math.h> 6 #in...

weixin_30666753的博客 134

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

Educational Codeforces Round 3 C

C. Load Balancing time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output In the school computer room there arenserv...

202

负载均衡(load balancing)介绍

此文章主要分析以下内容 负载均衡(load balancing): 负载均衡用处 如何负载均衡 有哪些负载均衡的项目 扩展: 1 .如何测试两台机器之间的传输速率,如何评测SA3的网络传输速率. 2. 如何测试SC3显存写入速率 1. 负载均衡用处 解决资源中的负载分配,以打到资源利用率最大. 这些资源包括计算机,网络链接,CPU,磁盘驱动器. 主要用于解决高并发和高可用. 2. 如何负载均...

疯狂的鸡窝 2381

Educational Codeforces Round 93-C-stl使用

题目链接 比赛的时候只想到了对每一个字符-1的操作,但是后续的处理完全是在抓瞎,始终只能想到O(n²)的暴力做法,赛后补题发现了map的妙用; 解题思路 对 给定字符串每个数的值-1(长度),题目就从 求 满足(子区间元素和=子区间长度)的子区间数量 变为了 求满足子区间和为0的子区间数量 对前缀和进行处理,如果两个前缀和相等,中间区间的和一定为0; 用map记录相同前缀的数量; 在循环中 ans+=map[前缀],得到的即为答案 如果在循环外求取ans 设每个前缀的值为ni 应该要遍历map中的每

lifeforge的博客 233

Educational Codeforces Round 57 (Rated for Div. 2) 小结 A,B,C

Educational Codeforces Round 57 (Rated for Div. 2) 小结 A,B,C 前言: 好几天没写博客了,先反省一下,然后codeforces 529打的很不好,还在补题,有时间应该会把博客补起来 ( 假的,最近cf超级多) 这一场应该算是数学场吧,前三题思路清晰的话还是很快的,第四题个人觉得是DP,反正想了很久都没有办法,后面的三个题真的也是数学题的样子,...

qq_42680479的博客 374

Educational Codeforces Round 93 (Rated for Div. 2) D

传送门 昨天写的时候直接找每一个矩阵的最大值,然后相加在一起, 然后就 Wrong answer on test 7 今天看了发现是三维dp

binggui2的博客 296

Educational codeforces Round 74

C 题意:有个cliff高为h,1-h由h个平台,有的伸出有的未伸出。当你跳下一个平台的时候,它和它下面那个平台的状态都会改变。一次只能最多下跳2格。可以使用A让平台状态改变,求最少使用A的次数让ta能安全到达地上(0平台) 思路:就是模拟… 注意如果在x+1平台,平台x到y都是未伸出时,相当于ta已经到达了平台y,就不用模拟了(不然会t) D 题意:由AB组成的string,求满足以下条件的字串...

weixin_43647238的博客 346

Educational Codeforces Round 93 (Rated for Div. 2)A-E题解

Educational Codeforces Round 93 (Rated for Div. 2)A-E题解 //写于大号rating值2075/2184,小号rating值1887/1887 //看电影鸽掉了这一场,早上补了一波题 比赛链接:https://codeforces.com/contest/1398 A题 水题 给你n条边,让你判断下是否存在三条边无法构成三角形。 无法构成三角形的情况是两条较小边的和,小于等于最大边的长度。 贪心选择所有边中最短的两条,和最长的那一条去对比下就是了,也就是让

StandNotAlone的博客 551

C. Good Subarrays(在线处理) Educational Codeforces Round 93 (Rated for Div. 2)

原题链接:http://codeforces.com/contest/1398/problem/C 样例: inputCopy 3 3 120 5 11011 6 600005 outputCopy 3 6 1 题意: 给定好子数组的概念:若子数组的元素之和等于元素个数,那么这个子数组就为好子数组。那么给你一个子数组序列字符串,判断该序列有多少个好子数组。 解题思路: 虽然暴力出奇迹,但是这道题不管你怎么暴力,都会TLE(亲测,留下悔恨的泪水)。那么既然不能暴力求解,我们肯定是有巧方法的,什么巧方法呢?

pursuit的博客 1363

A. Bad Triangle(几何基础水题) Educational Codeforces Round 93 (Rated for Div. 2)

原题链接:http://codeforces.com/contest/1398/problem/A 样例: input 3 7 4 6 11 11 15 18 20 4 10 10 10 11 3 1 1 1000000000 output 2 3 6 -1 1 2 3 题意: 给定一个非递减序列,任意取序列中的三个数是否能组成一个坏三角(即不能形成三角形),若能,输出这三个数的编号,若不能,输出-1。 解题思路: 由于给出的是非递减序列,即是已经排好序的,我们又想组成一个坏三角,(即选出的三条边存在

pursuit的博客 675

D. Colored Rectangles(动态规划问题) Educational Codeforces Round 93 (Rated for Div. 2)

原题链接: http://codeforces.com/contest/1398/problem/D 样例: input 1 1 1 3 5 4 output 20 input 2 1 3 9 5 1 2 8 5 output 99 input 10 1 1 11 7 20 15 19 14 2 4 13 14 8 11 output 372 题意: 你有三对彩棒的多重集合,即G,B,C三个数组,每个数组中元素代表的是对应彩棒的长度。你可以选择颜色不同的两对彩棒形成一个矩形。即形成的矩形它们的相对侧是相

pursuit的博客 1453
上一篇: Codeforces Round #334 (Div. 2) 604D Modular Arithmetic(数学+快速幂)
下一篇: Codeforces Round #335 (Div. 2) 606D Lazy Student(最小生成树+stl)
GKHack
博客等级 码龄11年 48粉丝 291原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值