Skip the Class

代码:

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ls rt<<1,l,m
#define rs rt<<1|1,m+1,r
#define pb push_back
#define mem(a,b) memset((a),(b),sizeof(a))
const int INF=0x3f3f3f3f;
const int N=;
struct lesson
{
string s;
int v;
operator < (const lesson &t) const
{
return v>t.v;
}
}a[N];
map<string,int>mp;
int main()
{
ios::sync_with_stdio(false);
cin.tie();
int t;
cin>>t;
while(t--)
{
mp.clear();
int n;
cin>>n;
for(int i=;i<n;i++)cin>>a[i].s>>a[i].v;
sort(a,a+n);
int ans=;
for(int i=;i<n;i++)
{
if(mp[a[i].s]<)
{
ans+=a[i].v;
mp[a[i].s]++;
}
}
cout<<ans<<endl;
}
return ;
}

HDU 6015 Skip the Class的更多相关文章

  1. HDU 6015 Skip the Class 优先队列 map的使用

    Skip the Class Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Tota ...

  2. (bc 1001) hdu 6015 skip the class

    Skip the Class Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) T ...

  3. BestCoder Round #92 (hdu 6015 6016)

    比赛链接 A题主要是map的使用,比赛的时候问了下队友,下次要记住了 #include<bits/stdc++.h> using namespace std; typedef long l ...

  4. hdu多校第二场 1010 (hdu6600)Just Skip This Problem

    题意: 给你一个数x,允许你多次询问yi,然后回答你x xor yi 是否等于yi,询问尽量少的次数以保证能求出xi是几,求出这样询问次数最少的询问方案数. 结果mod1e6+3 题解: 队友赛时很快 ...

  5. HDU 5724:Chess(博弈 + 状压)

    http://acm.hdu.edu.cn/showproblem.php?pid=5724 Chess Problem Description   Alice and Bob are playing ...

  6. HDU 5724 Chess(国际象棋)

    HDU 5724 Chess(国际象棋) Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Oth ...

  7. HDU 5724 Chess (sg函数)

    Chess 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5724 Description Alice and Bob are playing a s ...

  8. 2013 多校联合2 D Vases and Flowers (hdu 4614)

    Vases and Flowers Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others ...

  9. hdu 5724 SG+状态压缩

    Chess Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submi ...

随机推荐

  1. Summary: rand5构造rand7

    给一个方法,比如 rand5(), 它能够等概率生成 1-5 之间的整数. 所谓等概率就是1,2,3,4,5 生产的概率均为 0.2 .现在利用rand5(), 构造一个能够等概率生成 1- 7 的方 ...

  2. c#中ref和out使用及区别

    在c#中,使用方法获得返回值时,只能获取一个返回值.当使用ref和out关键字后,可以获取多个返回值. MSDN对ref和out关键字的说明如下: ref 关键字: 使参数按引用传递.其效果是,当控制 ...

  3. zw版【转发·台湾nvp系列Delphi例程】HALCON MirrorImage

    zw版[转发·台湾nvp系列Delphi例程]HALCON MirrorImage procedure TForm1.Button1Click(Sender: TObject);var img, im ...

  4. eclipse调优

    基于Eclipse 4.7.0 (Oxygen) 目的:加快eclipse启动速度 修改eclipse安装目录下配置文件eclipse.ini(1)指定eclipse运行的jre,不让其进行搜索-vm ...

  5. kafka存储数据量过大,导致磁盘爆满

    问题: 注意到自己负责kafka的某个topic最小的偏移量为0,而最大的偏移量都7亿多了,说明存储在kafka里面的数据没有定时删除,通过登陆到kafka服务器,查看配置文件services.pro ...

  6. js 内置对象和方法 示例

    JS内置函数不从属于任何对象,在JS语句的任何地方都可以直接使用这些函数.JS中常用的内置函数如下: 1.eval(str)接收一个字符串形式的表达式,并试图求出表达式的值.作为参数的表达式可以采用任 ...

  7. linux服务器文件索引inodes满了

    inode节点中,记录了文件的类型.大小.权限.所有者.文件连接的数目.创建时间与更新时间等重要的信息,还有一个比较重要的内容就是指向数据块的指针.一般情况不需要特殊配置,如果存放文件很多,需要配置. ...

  8. android 简单的控件前端代码

    /Hello_word/res/layout/activity_main.xml Graphical  Layout/activity_fullsreen.xml(layout/) 代码与设置界面互换 ...

  9. powershell配置Gvim

    1.下载安装Gvim 我的安装目录在:C:\gVimPortable 配色方案目录:C:\gVimPortable\App\vim\vim72\colors 配置文件目录:C:\gVimPortabl ...

  10. 20145122《JAVA开发环境的熟悉》实验报告

    package fib; public class fibonaci { public static void main(String[] args) { Fibonaci(20); } public ...