[topcoder]SRM 647 DIV 2
第一题,送分题。
第二题,
#include <vector>
#include <algorithm>
#include <map>
#include <queue>
using namespace std; class TravellingSalesmanEasy {
public:
int getMaxProfit(int M, vector <int> profit, vector <int> city, vector <int> visit) {
map<int, priority_queue<int>> mm;
int result = M - M;
for (int i = 0; i < profit.size(); i++) {
mm[city[i]].push(profit[i]);
}
for (int i = 0; i < visit.size(); i++) {
if (mm[visit[i]].size() > 0) {
result += mm[visit[i]].top();
mm[visit[i]].pop();
}
}
return result;
}
};
第三题,过了基本测试用例,没过后继测试。等官方文章。
[topcoder]SRM 647 DIV 2的更多相关文章
- TopCoder SRM 560 Div 1 - Problem 1000 BoundedOptimization & Codeforces 839 E
传送门:https://284914869.github.io/AEoj/560.html 题目简述: 定义"项"为两个不同变量相乘. 求一个由多个不同"项"相 ...
- TopCoder SRM 667 Div.2题解
概览: T1 枚举 T2 状压DP T3 DP TopCoder SRM 667 Div.2 T1 解题思路 由于数据范围很小,所以直接枚举所有点,判断是否可行.时间复杂度O(δX × δY),空间复 ...
- [topcoder]SRM 646 DIV 2
第一题:K等于1或者2,非常简单.略.K更多的情况,http://www.cnblogs.com/lautsie/p/4242975.html,值得思考. 第二题:http://www.cnblogs ...
- [topcoder]SRM 633 DIV 2
第一题,http://community.topcoder.com/stat?c=problem_statement&pm=13462&rd=16076 模拟就可以了. #includ ...
- TopCoder SRM 596 DIV 1 250
body { font-family: Monospaced; font-size: 12pt } pre { font-family: Monospaced; font-size: 12pt } P ...
- Topcoder SRM 656 (Div.1) 250 RandomPancakeStack - 概率+记忆化搜索
最近连续三次TC爆零了,,,我的心好痛. 不知怎么想的,这题把题意理解成,第一次选择j,第二次选择i后,只能从1~i-1.i+1~j找,其实还可以从j+1~n中找,只要没有被选中过就行... [题意] ...
- Topcoder SRM 648 (div.2)
第一次做TC全部通过,截图纪念一下. 终于蓝了一次,也是TC上第一次变成蓝名,下次就要做Div.1了,希望div1不要挂零..._(:зゝ∠)_ A. KitayutaMart2 万年不变的水题. # ...
- 【topcoder SRM 702 DIV 2 250】TestTaking
Problem Statement Recently, Alice had to take a test. The test consisted of a sequence of true/false ...
- TopCoder SRM 639 Div.2 500 AliceGameEasy
题意: 一个游戏有n轮,有A和B比赛,谁在第 i 轮得胜,就获得 i 分,给出x,y,问A得x分,B得y分有没有可能,如果有,输出A最少赢的盘数 解题思路: 首先判断n(n+1)/2 = (x+y)是 ...
随机推荐
- 【学习笔记】Python 3.6模拟输入并爬取百度前10页密切相关链接
[学习笔记]Python 3.6模拟输入并爬取百度前10页密切相关链接 问题描述 通过模拟网页,实现百度搜索关键词,然后获得网页中链接的文本,与准备的文本进行比较,如果有相似之处则代表相关链接. me ...
- codeforces-984D——XOR-pyramid(DP)
题目传送门 题目描述:给你一个f函数,这个函数的自变量是一个数列,函数表达式就是题目所给的描述,然后给你一个数列,问你数列中某区间 怎么选取 可以使函数值最大. 题目思路: 有关区间选取的问题,很 ...
- 从M进制转换为N进制
/// <summary> /// 从M进制转换为N进制 /// </summary> internal class MBase2NBase { /// <summary ...
- python3 多线程笔记
import threadingimport time #继承 class threading.Threadclass MyThread(threading.Thread): #类做初始化 def _ ...
- hive 存储格式及压缩
-- 设置参数 set hivevar:target_db_name=db_dw; use ${hivevar:target_db_name}; -- 创建textfile表 create table ...
- SVN更改通知的工具commitmonitor
SVN更改通知的工具commitmonitor 下载地址: https://sourceforge.net/projects/commitmonitor/files/latest/download 工 ...
- windows开机启动软件设置
开机启动软件设置 操作步骤如下: 1.按win+r,输入 C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup,点击确定: 2.拖动 ...
- thinkPHP Model的操作
1.建立一个表 create table Demo( -> id int, ), -> age int, ) -> ); 2.新增数据 2.1面向过程的风格 $d = $a-> ...
- yii1的后台分页和列表
控制器: public function actionIndex(){ $model = new Cases('search'); $model->unsetAttributes(); // c ...
- python 基础内置函数表及简单介绍
内建函数名 (表达形式) 主要作用 备注 abs(x) 返回一个X值得绝对值(x=int/float/复数) all(iterable) 如果 iterable 的所有元素均为 True(或 iter ...