CF57B.Martian Architecture

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Chris the Rabbit found the traces of an ancient Martian civilization. The brave astronomer managed to see through a small telescope an architecture masterpiece — "A Road to the Sun". The building stands on cubical stones of the same size. The foundation divides the entire "road" into cells, into which the cubical stones are fit tightly. Thus, to any cell of the foundation a coordinate can be assigned. To become the leader of the tribe, a Martian should build a Road to the Sun, that is to build from those cubical stones on a given foundation a stairway. The stairway should be described by the number of stones in the initial coordinate and the coordinates of the stairway's beginning and end. Each following cell in the coordinate's increasing order should contain one cubical stone more than the previous one. At that if the cell has already got stones, they do not count in this building process, the stairways were simply built on them. In other words, let us assume that a stairway is built with the initial coordinate of ll , the final coordinate of rr and the number of stones in the initial coordinate xx . That means that xx stones will be added in the cell ll , x+1x+1 stones will be added in the cell l+1l+1 , ..., x+rlx+r-l stones will be added in the cell rr .

Chris managed to find an ancient manuscript, containing the descriptions of all the stairways. Now he wants to compare the data to be sure that he has really found "A Road to the Sun". For that he chose some road cells and counted the total number of cubical stones that has been accumulated throughout the Martian history and then asked you to count using the manuscript to what the sum should ideally total.

输入格式

The first line contains three space-separated integers: n,m,kn,m,k ( 1<=n,m<=105,1<=k<=min(n,100)1<=n,m<=10^{5},1<=k<=min(n,100) ) which is the number of cells, the number of "Roads to the Sun" and the number of cells in the query correspondingly. Each of the following mm roads contain three space-separated integers: ai,bi,cia_{i},b_{i},c_{i} ( 1<=ai<=bi<=n,1<=ci<=10001<=a_{i}<=b_{i}<=n,1<=c_{i}<=1000 ) which are the stairway's description, its beginning, end and the initial cell's height. Then follow a line, containing kk different space-separated integers bib_{i} . All these numbers ranging from 11 to nn are cells, the number of stones in which interests Chris.

输出格式

You have to print a single number on a single line which is the sum of stones in all the cells Chris is interested in.

Please, do not use %lld specificator to read or write 64-bit integers in C++. It is preffered to use cin (also you may use %I64d).

输入输出样例

  • 输入#1

    5 2 1
    1 5 1
    2 4 1
    3
    

    输出#1

    5
    
  • 输入#2

    3 2 1
    1 3 1
    1 3 1
    2
    

    输出#2

    4
    
  • 输入#3

    3 2 1
    1 3 1
    1 3 1
    3
    

    输出#3

    6
    
首页