Magical Forest】的更多相关文章

Magical Forest Time Limit: 24000/12000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 724    Accepted Submission(s): 343 Problem Description There is a forest can be seen as N * M grid. In this forest, there is so…
2014多校7最水的题   Magical Forest Magical Forest Time Limit: 24000/12000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 253    Accepted Submission(s): 120 Problem Description    There is a forest can be seen as N * M…
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4941 Magical Forest Description There is a forest can be seen as $N * M$ grid. In this forest, there is some magical fruits, These fruits can provide a lot of energy, Each fruit has its location$(X_i, Y_…
Magical Forest Time Limit: 24000/12000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 135    Accepted Submission(s): 69 Problem Description There is a forest can be seen as N * M grid. In this forest, there is so…
Problem Description There is a forest can be seen as N * M grid. In this forest, there is some magical fruits, These fruits can provide a lot of energy, Each fruit has its location(Xi, Yi) and the energy can be provided Ci. However, the forest will m…
Problem Description There is a forest can be seen as N * M grid. In this forest, there is some magical fruits, These fruits can provide a lot of energy, Each fruit has its location(Xi, Yi) and the energy can be provided Ci.  However, the forest will…
思路:将行列离散化,那么就可以用vector 存下10W个点 ,对于交换操作 只需要将行列独立分开标记就行   . r[i] 表示第 i 行存的是 原先的哪行         c[j] 表示 第 j 列 存的是原先的哪列. 查询只需要一个二分即可. #include <iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #include&…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4941 解题报告:给你一个n*m的矩阵,矩阵的一些方格中有水果,每个水果有一个能量值,现在有三种操作,第一种是行交换操作,就是把矩阵的两行进行交换,另一种是列交换操作,注意两种操作都要求行或列至少要有一个水果,第三种操作是查找,询问第A行B列的水果的能量值,如果查询的位置没有水果,则输出0. 因为n和m都很大,达到了2*10^9,但水果最多一共只有10^5个,我的做法是直接用结构体存了之后排序,然后m…
题意: 有n*m个格子(n,m <= 2*10^9),有k(k<=10^5)个格子中有值,现在有三种操作,第一种为交换两行,第二种为交换两列,交换时只有两行或两列都有格子有值或都没有格子有值时才能交换,第三种操作是询问现在第A行第B列值为多少. 解法:格子太大,但是k比较小,所以考虑离散一下,把行离散出来,最多10^5行,列用map存下即可. nowR[i] = j 时表示现在的第 i 行是原来的第 j 行, nowC表示列的 R[]表示该行有没有值, CntC[]表示列 然后交换时直交换上面…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4941 题目大意:给你10^5个点.每一个点有一个数值.点的xy坐标是0~10^9.点存在于矩阵中.然后给出10^5个操作.1代表交换行.2代表交换列,3代表查询坐标为xy点的数值. 数据量非常大........ 所以一直没有思路 后来赛后看了题解是先用离散化然后存在线性map里面. 用hx,hy来存放离散化后的点的坐标,用linkx,linky来存放点离散化之后的点的坐标的行与列. 还是对于STL里…