第一题,送分题。

第二题,

#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的更多相关文章

  1. TopCoder SRM 560 Div 1 - Problem 1000 BoundedOptimization & Codeforces 839 E

    传送门:https://284914869.github.io/AEoj/560.html 题目简述: 定义"项"为两个不同变量相乘. 求一个由多个不同"项"相 ...

  2. TopCoder SRM 667 Div.2题解

    概览: T1 枚举 T2 状压DP T3 DP TopCoder SRM 667 Div.2 T1 解题思路 由于数据范围很小,所以直接枚举所有点,判断是否可行.时间复杂度O(δX × δY),空间复 ...

  3. [topcoder]SRM 646 DIV 2

    第一题:K等于1或者2,非常简单.略.K更多的情况,http://www.cnblogs.com/lautsie/p/4242975.html,值得思考. 第二题:http://www.cnblogs ...

  4. [topcoder]SRM 633 DIV 2

    第一题,http://community.topcoder.com/stat?c=problem_statement&pm=13462&rd=16076 模拟就可以了. #includ ...

  5. TopCoder SRM 596 DIV 1 250

    body { font-family: Monospaced; font-size: 12pt } pre { font-family: Monospaced; font-size: 12pt } P ...

  6. Topcoder SRM 656 (Div.1) 250 RandomPancakeStack - 概率+记忆化搜索

    最近连续三次TC爆零了,,,我的心好痛. 不知怎么想的,这题把题意理解成,第一次选择j,第二次选择i后,只能从1~i-1.i+1~j找,其实还可以从j+1~n中找,只要没有被选中过就行... [题意] ...

  7. Topcoder SRM 648 (div.2)

    第一次做TC全部通过,截图纪念一下. 终于蓝了一次,也是TC上第一次变成蓝名,下次就要做Div.1了,希望div1不要挂零..._(:зゝ∠)_ A. KitayutaMart2 万年不变的水题. # ...

  8. 【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 ...

  9. 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)是 ...

随机推荐

  1. HTTP Status 500 - org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:

    HTTP Status 500 - org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.e ...

  2. vue.js路由嵌套

    <!DOCTYPE html> <html> <head> <title></title> <meta charset="u ...

  3. DesiredCapabilities内容详解--Appium服务关键字

    上次了解了一些DesiredCapabilities的用法,有些还是不太清楚,去appium官网找了找官方文档,觉得写的很全: ## Appium 服务关键字 <expand_table> ...

  4. 图像标注工具labelImg安装记录

    这里仅记载下labelImg的安装过程,因为有坑. 我的安装方式是从源码编译,环境ubuntu16.04,一开始是使用python2安装,从github上下载好源码,然后执行安装命令 sudo apt ...

  5. 江西财经大学第一届程序设计竞赛 B

    链接:https://www.nowcoder.com/acm/contest/115/B来源:牛客网 题目描述 给出一个出生日期,比如:1999-09-09, 问:从出生那一天开始起,到今天2018 ...

  6. linux 学习2 (基于ubuntu)

    一.远程管理命令 关机/重启 shutdown   reboot(重启)   halt(直接关机) 查看或配置网卡信息 ifconfig ping 远程登录和复制文件 ssh ping 1. 关机/重 ...

  7. C语言变参函数的实现原理

    1. 变参函数简单示例 #include <stdarg.h> #include <stdio.h> int Accumlate(int nr, ...) { ; ; va_l ...

  8. 基础 —— ip地址与子网掩码的认识

    目录: 1.IP地址的作用 2.IP地址如何表示 3.IP地址的结构 4.子网掩码 5.IP地址的分类 6.私有IP地址 7.二进制与十进制的转换 8.练习题 IP地址的作用: 在一定范围内,唯一的标 ...

  9. Vue 参数传递及刷新后依旧存在

    获取参数方式有两种: 1.params2.query 第一种方式: params this.$router.push({name:'Hello',params:{name:'zs',age:'22'} ...

  10. python迭代器、生成器、列表推倒式

    创建迭代器: iter( ): 创建迭代器 next( ): 返回迭代器的下一个element(元素) 实例题: >>> list = [1,2,3,4] >>> ...