2014—多校训练2(ZCC Loves Codefires)

2014—多校训练2(ZCC Loves Codefires)

ZCC Loves Codefires

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 790    Accepted Submission(s): 420

Problem Description
Though ZCC has many Fans, ZCC himself is a crazy Fan of a coder, called “Memset137”.

It was on Codefires(CF), an online competitive programming site, that ZCC knew Memset137, and immediately became his fan.

But why?

Because Memset137 can solve all problem in rounds, without unsuccessful submissions; his estimation of time to solve certain problem is so accurate, that he can surely get an Accepted the second he has predicted. He soon became IGM, the best title of Codefires. Besides, he is famous for his coding speed and the achievement in the field of Data Structures.

After become IGM, Memset137 has a new goal: He wants his score in CF rounds to be as large as possible.

What is score? In Codefires, every problem has 2 attributes, let’s call them Ki and Bi(Ki, Bi>0). if Memset137 solves the problem at Ti-th second, he gained Bi-Ki*Ti score. It’s guaranteed Bi-Ki*Ti is always positive during the round time.

Now that Memset137 can solve every problem, in this problem, Bi is of no concern. Please write a program to calculate the minimal score he will lose.(that is, the sum of Ki*Ti).
 

 

Input
The first line contains an integer N(1≤N≤10^5), the number of problem in the round.

The second line contains N integers Ei(1≤Ei≤10^4), the time(second) to solve the i-th problem.

The last line contains N integers Ki(1≤Ki≤10^4), as was described.
 

 

Output
One integer L, the minimal score he will lose.
 

 

Sample Input
3 10 10 20 1 2 3

 

 

Sample Output
150

Hint

Memset137 takes the first 10 seconds to solve problem B, then solves problem C at the end of the 30th second. Memset137 gets AK at the end of the 40th second. L = 10 * 2 + (10+20) * 3 + (10+20+10) * 1 = 150.

 

 

Author
镇海中学
 

 

Source
代码:
2014---多校训练2(ZCC Loves Codefires)
2014---多校训练2(ZCC Loves Codefires)

 1 #include<cstdio>
 2 #include<iostream>
 3 #include<algorithm>
 4 using namespace std;
 5 struct node{
 6   int e,t;
 7   bool operator < (const node a) const{
 8       return  e*a.t>a.e*t;
 9   }
10 }map[100005];
11 int main(){
12     int n,i;
13     __int64 tat,ans;
14     while(scanf("%d",&n)!=EOF){
15       for(i=0;i<n;i++)
16       scanf("%d",&map[i].t);
17       for(i=0;i<n;i++)
18       scanf("%d",&map[i].e);
19      sort(map,map+n);
20      for(ans=tat=i=0;i<n;i++){
21          tat+=map[i].t;
22          ans+=tat*map[i].e;
23      }
24      printf("%I64d\n",ans);
25     }
26   return 0;
27 }

View Code

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/109739.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 华硕老毛子Padavan使用IPV6+Aliddns远程管理路由

    华硕老毛子Padavan使用IPV6+Aliddns远程管理路由华硕老毛子Padavan使用IPV6远程管理路由前言一、pandas是什么?二、使用步骤1.引入库2.读入数据总结前言提示:以下是本篇文章正文内容,下面案例可供参考一、pandas是什么?示例:pandas是基于NumPy的一种工具,该工具是为了解决数据分析任务而创建的。二、使用步骤1.引入库代码如下(示例):importnumpyasnpimportpandasaspdimportmatplotlib.pyplotaspltimportseaborna

    2022年6月5日
    515
  • 1155针低功耗cpu有哪些_2011针低功耗cpu

    1155针低功耗cpu有哪些_2011针低功耗cpu一、“A”的含义:Pentium4处理器有Willamette、Northwood和Prescott三种不同核心。其中Willamette核心属于最早期的产品,采用0.18微米工艺制造。。。。二、“B”的含义:同样频率的产品,在更高的外频下可具备更高的前端总线,因此性能也更高。为此Intel在提升CPU频率的同时,也在不断提高产品的前端总线。于是从可以支持533MHzFSB的845E等主板上市…

    2022年9月20日
    0
  • TXS0104E电平转换工作原理_电平指示芯片

    TXS0104E电平转换工作原理_电平指示芯片TXB0304作为新一代自动识别方向的电平转换芯片,跟上一代同类器件TXB0104相比,具有更低的工作电压(0.9V)、更高的转换速率(1.8V-3.3V间电平转换时最高速率140MBPS)、以及更小的封装等优势。也正是因为需要在较低工作电压时也能达到较高的转换速率,芯片在某些关键参数设计上,也跟上一代产品有所不同,比如ONE-SHOT输出电路的MOS管内阻必须要设计得更小一些。这就要求在某些特殊情况下应用时(比如输出PCB走线较长),需要额外留意电路原理图的设计和PCB布线设计,以减轻输出过冲和震荡的现象

    2022年8月10日
    10
  • jmeter正则表达式提取器的用法和正则「建议收藏」

    jmeter正则表达式提取器的用法和正则「建议收藏」我们再使用jmeter请求接口时,碰到一些业务流程性的接口改怎么办,比如,我一个发布内容的接口需要用到登录接口返回的token加到请求上去才能发布内容,那在jmeter上该是如何实现的咧?这里介绍的是jmeter的正则表达式提取器1,把正则表达式添加到需要提取返回内容的http请求里,添加步骤是,,右键http请求–添加–后置处理器–正则表达式处理器2,在正则表达式提取器配置设置页里,1)要检查的响应字段:相当于是要提取哪个位置的内容数据……

    2022年9月11日
    0
  • 大数据应用开发八大基本原则

    大数据应用开发八大基本原则·        大数据应用正在从概念走向现实,而企业在大数据应用开发时,软件的弹性(Resilient)正在成为决定大数据应用成败的关键因素。弹性差的应用无法应对大规模的数据集,在测试和运营中也缺乏透明度,而且也不安全。·        避免大数据应用在生产环境中掉链子的最佳办法就是在开发阶段就开发弹性应用,例如:健壮性、经过测试、可改变、可审计、高安全、可监控。·        可以说

    2022年6月4日
    36
  • 用原子操作实现无锁编程[通俗易懂]

    用原子操作实现无锁编程[通俗易懂]假设我们要维护一个全局的线程安全的int类型变量count,下面这两行代码都是很危险的:count++;count+=n;我们知道,高级语言中的一条语句,并不是一个原子操作.比如一个最简单的自增操作就分为三步: 1.从缓存取到寄存器2.在寄存器加13.存入缓存。多个线程访问同一块内存时,需要加锁来保证访问操作是互斥的. 所以,我

    2022年5月27日
    44

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号