2014. Zhenya moves from parents

Time limit: 1.0 second
Memory limit: 64 MB
Zhenya moved from his parents’ home to study in other city. He didn’t take any cash with him, he only took his father’s credit card with zero balance on it. Zhenya succeeds in studies at the University and sometimes makes a little money on the side as a Maths tutor. As he makes his own money he spends only it, and when it is over he uses the credit card. Every time he gets or spends money, he sends a letter to his father, where he puts the following two things.
  1. The date when it took place
  2. The sum of earned or spent money
Every time receiving a letter from Zhenya, his father calculates the debt on the credit card at the moment. But here a problem arises. The point is that Russian Post delivers letters in an order different to the one they were sent in.
For example, in the first Zhenya’s letter the father read that on September 10 Zhenya spent one thousand rubles. He thought that his son had used the credit card, and now the debt is one thousand rubles. However the next day came a letter with the information that on September 9 Zhenya earned five hundred rubles. It means that half of the money he spent on September 10 was his own, and the debt on the credit card is just five hundred rubles.
Help Zhenya’s father with his account management.

Input

The first line contains an integer n which is the number of Zhenya’s letters (1 ≤ n ≤ 100 000). These letters are listed in the next n lines. Description of each letter consists of the amount of money Zhenya spent or earned (in the form -c or +c accordingly, where c is an integer, 1 ≤ c ≤ 50 000) followed by both date and time when it took place (in the form of dd.MM hh:mm). All dates belong to the same year, which is not leap (i. e. there are 365 days in it). Any two letters contain either different dates or different time. The letters are listed in the order the father received them.

Output

After each received letter output what Zhenya’s father thinks the amount of the debt on the credit card is.

Sample

input output
5
-1000 10.09 21:00
+500 09.09 14:00
+1000 02.09 00:00
-1000 17.09 21:00
+500 18.09 13:00
-1000
-500
0
-500
-500
Problem Author: Nick Burlakov (prepared by Olga Soboleva)
Problem Source: NEERC 2014, Eastern subregional contest
 
 
 
 

ural 2014 Zhenya moves from parents的更多相关文章

  1. URAL 2014 Zhenya moves from parents --线段树

    题意:儿子身无分文出去玩,只带了一张他爸的信用卡,当他自己现金不足的时候就会用信用卡支付,然后儿子还会挣钱,挣到的钱都是现金,也就是说他如果有现金就会先花现金,但是有了现金他不会还信用卡的钱.他每花一 ...

  2. Gym 100507C Zhenya moves from parents (线段树)

    Zhenya moves from parents 题目链接: http://acm.hust.edu.cn/vjudge/contest/126546#problem/C Description Z ...

  3. ural2014 Zhenya moves from parents

    Zhenya moves from parents Time limit: 1.0 secondMemory limit: 64 MB Zhenya moved from his parents’ h ...

  4. ural 2015 Zhenya moves from the dormitory(模拟)

    2015. Zhenya moves from the dormitory Time limit: 1.0 secondMemory limit: 64 MB After moving from hi ...

  5. zhenya moves from parents

    Zhenya moved from his parents' home to study in other city. He didn't take any cash with him, he onl ...

  6. 【线段树】Gym - 100507C - Zhenya moves from parents

    线段树每个结点维护两个值,分别是这个区间的 负债 和 余钱. 按时间顺序从前往后看的时候,显然负债是单调不减的. 按时间顺序从后往前看的时候,显然余钱也是单调不减的,因为之前如果有余钱,可能会增加现在 ...

  7. Gym 100507D Zhenya moves from the dormitory (模拟)

    Zhenya moves from the dormitory 题目链接: http://acm.hust.edu.cn/vjudge/contest/126546#problem/D Descrip ...

  8. D - Zhenya moves from the dormitory URAL - 2015

    After moving from his parents’ place Zhenya has been living in the University dormitory for a month. ...

  9. NEERC 2014, Eastern subregional contest

    最近做的一场比赛,把自己负责过的题目记一下好了. Problem B URAL 2013 Neither shaken nor stirred 题意:一个有向图,每个结点一个非负值,可以转移到其他结点 ...

随机推荐

  1. [LeetCode-21]Construct Binary Tree from Preorder and Inorder Traversal

    Given preorder and inorder traversal of a tree, construct the binary tree. Note: You may assume that ...

  2. PyQt4 颜色选择,字体选择代码

    # -*- coding: utf-8 -*- """ ------------------------------------------------- File Na ...

  3. MyEclipse工具栏的隐藏与显示及自定义

    Myeclipse的工具栏 1.隐藏 工具栏---->右键---->hide toolbar 2.显示     window ----> show toolbar 3.自定义     ...

  4. MySQL数据库(6)_用户操作与权限管理、视图、存储过程、触发器、基本函数

    用户操作与权限管理 MySQL用户操作 创建用户 方法一: CREATE USER语句创建 CREATE USER "用户名"@"IP地址" IDENTIFIE ...

  5. jQuery:自学笔记(4)——事件与事件对象

    jQuery:自学笔记(4)——事件与事件对象 jQuery中的事件 什么是事件 所谓事件,就是被对象识别的操作,即操作对象队环境变化的感知和反应,例如单击按钮或者敲击键盘上的按键. 所谓事件流,是指 ...

  6. [转载]OpenWRT使用wifidog实现强制认证的WIFI热点 | 半个橙子

    首先安装wifidog到OpenWRT的路由器: opkg update opkg install wifidog wifidog依赖下面这些模块: iptables-mod-extra iptabl ...

  7. 轻量级的Java 开发框架 Spring

    Spring是一个开源框架,Spring是于2003 年兴起的一个轻量级的Java 开发框架,由Rod Johnson 在其著作Expert One-On-One J2EE Development a ...

  8. Javascript中一些常用的宽与高

    在使用javascript制作一些网络特效时,往往要根据显示网页的显示器的一些参数展开进行.所以一些关于显示器的参数如何得到显得十分重要.下面是一些常用的显示器参数,不妨好好记一下吧! 网页可见区域宽 ...

  9. Mybatis细节问题

    1.将字符串转换为日期格式? @DateTimeFormat(pattern="yyyy-MM-dd")

  10. Python根据内嵌的数字将字符串排序(sort by numbers embedded in strings)

    import re  re_digits = re.compile(r'(\d+)')  def embedded_numbers(s):       pieces = re_digits.split ...