题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&category=648&page=show_problem&problem=5153 In an infinite chess board, some pawns are placed on some cells.You have a rectangular bomb that is W width and H…
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&category=648&page=show_problem&problem=5160 There is a tree with N nodes, and every node has a weighted value. A RIP (restricted increasing path)is a directe…
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&category=648&page=show_problem&problem=5150 题目大意:给一幅N个点M条边的无向图,有一些边,其中一部分只能涂红色,一部分只能涂黑色,一部分两种颜色都可以涂.现要求红色的边不超过K条的生成树个数模1e9+7的值. 思路:感谢昂神滋磁,贴链接:http://sd-invol…
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&category=648&page=show_problem&problem=5155 There are N guests checking in at the front desk of the hotel. 2K (0 ≤ 2K ≤ N) of them are twins.There are M room…
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&category=648&page=show_problem&problem=5159 In normal football games, the winner team gets 3 points, loser team gets 0 point, and if there is a drawgame, bot…
题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&category=648&page=show_problem&problem=5151You have a rectangle of size N × M, N rows from top to bottom and M columns from left to right,that is divided int…
Long long ago there is a strong tribe living on the earth. They always have wars and eonquer others.One day, there is another tribe become their target. The strong tribe has decide to terminate them!!!There are m villages in the other tribe. Each vil…
模拟题: add的时候出现过的则不再添加 close的时候会影响到top rotate(Prior.Choose)的时候会影响到top /*=============================================================== * Copyright (C) 2014 All rights reserved. * * File Name: hdu5071.cpp * Author:sunshine * Created Time: 2014-11-11 *…
Galaxy Problem's Link:   http://acm.hdu.edu.cn/showproblem.php?pid=5073 Mean: 在一条数轴上,有n颗卫星,现在你可以改变k颗卫星的位置,使得剩下的n-k颗卫星到某个点(不固定)的距离的平方和最小. 抽象成数学语言后等价于:数轴上有n个点,现在去掉k个点,使得剩下的n-k个点的方差最小,求方差*n的值. analyse: 一道让人很容易想偏的数学题.首先说一下我的思路: 1)我们最终的目的是让这n-k个点尽量的集中,所以去…
Hatsune Miku Problem's Link:   http://acm.hdu.edu.cn/showproblem.php?pid=5074 Mean: 有m种音符(note),现在要从这m种音符中选出n个来组成一首歌,相邻两个音符之间会有一个评分的方式,即score(i,j),而score(i,j)题目已经给出,现在要你按照题目的规定来选出n个音符来使得最终的分数最高. analyse: 鞍山赛区第二大水题,很简单的dp. 具体思路:dp[i][j]表示第i个音符选择的是第j种.…
Osu! Problem's Link:   http://acm.hdu.edu.cn/showproblem.php?pid=5078 Mean: 略. analyse: 签到题,直接扫一遍就得答案,但是现场赛的时候也是卡了好久,估计队友也是被爆int坑了吧. Time complexity: O(n) Source code:  // Memory Time // 1347K 0MS // by : Snarl_jsb // 2014-11-15-10.58 #include<algori…
最后一次参加亚洲区…… 题意:给出n(3 ≤ n ≤ 105)个数字,每个数ai满足1 ≤ ai ≤ 105,求有多少对(a,b,c)满足[(a, b) = (b, c) = (a, c) = 1] or [(a, b) ≠ 1 and (a, c) ≠ 1 and (b, c) ≠ 1],都互素或都不互素. 思路:如果是两个数,互素比较好求,边遍历边分解质因子,利用容斥原理即可知道前面与自己互素的有多少.left_prime[i]表示左边与自己互素的,left_no_prime[i]表示左边与…
推公式 #include <cstdio> #include <cmath> #include <iomanip> #include <iostream> #include <algorithm> using namespace std; typedef long long ll; const int N = 50000+3; ll a[N], b[N]; int main() { int T, n, m, len; ll x, sum, ans…
简单dp #include <stdio.h> #include <cstring> #include <iostream> #include <map> using namespace std; typedef unsigned long long ull; const int N = 105; int n, m, a[N]; int s[N][N], dp[2][N]; void pt(int x ){ for(int i = 1; i <= m;…
H题意: 给你一个n个节点n-1条无向边构成的树,每一个节点有一个权值wi,你需要把这棵树划分成k个子树,每一个子树的权值是这棵子树上所有节点权值之和. 你要输出这k棵子树的权值中那个最大的.你需要让输出的结果尽可能小 题解: 二分结果,重要的是判断这个二分的值是否满足题目要求 对于划分子树的选择,就选择子树中权值最大且又满足二分的答案的那个子树 代码: #include <bits/stdc++.h> using namespace std; typedef long long ll; co…
posters 时间限制:1000 ms  |  内存限制:65535 KB 难度:6   描述 The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all places at their whim. The city council has finally de…
题目链接:http://acm.sgu.ru/problem.php?contest=0&problem=180 解题报告:一个裸的求逆序对的题,离散化+线段树,也可以用离散化+树状数组.因为这题中的数列有重复的而且范围特别大,所以要进行离散化,离散化的方法是, 首先按照输入的数字排个序,然后把整个数列扫一遍,得出每个数字离散化的结果,然后再按照输入的顺序把顺序调整回来就OK 了.线段树部分就不说了. #include<cstdio> #include<cstring> #…
Mayor's posters Time Limit: 1000MS    Memory Limit: 65536K   Description The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all places at their whim. The cit…
1721: 感恩节KK专场——雪人的高度 时间限制: 1 Sec  内存限制: 128 MB 提交: 81  解决: 35 [提交][状态][讨论版] 题目描述 大雪过后,KK决定在春秋大道的某些区间上堆雪人.现在KK遇到了一道统计雪人高度的难题,请你帮帮他吧.注:KK堆雪人前春秋大道上是没有雪人的即所有位置雪人高度为0. 输入 给定一个整数t,表示有t(t<=5)组测试数据.每组测试数据有两个整数N(1<=N<=200000),表示N次操作. 操作分四种:    U1 x y v  …
[BZOJ1645][Usaco2007 Open]City Horizon 城市地平线 Description Farmer John has taken his cows on a trip to the city! As the sun sets, the cows gaze at the city horizon and observe the beautiful silhouettes formed by the rectangular buildings. The entire ho…
原文地址:http://www.cnblogs.com/GXZlegend/p/6801379.html 题目描述 蒟蒻DCrusher不仅喜欢玩扑克,还喜欢研究数列 题目描述 DCrusher有一个数列,初始值均为0,他进行N次操作,每次将数列[a,b)这个区间中所有比k小的数改为k,他想知道N次操作后数列中所有元素的和.他还要玩其他游戏,所以这个问题留给你解决. 输入 第一行一个整数N,然后有N行,每行三个正整数a.b.k. N<=40000 , a.b.k<=10^9 输出 一个数,数列…
题目传送门 题意:给出一些花开花落的时间,问某个时间花开的有几朵 分析:这题有好几种做法,正解应该是离散化坐标后用线段树成端更新和单点询问.还有排序后二分查找询问点之前总花开数和总花凋谢数,作差是当前花开的数量,放张图易理解: 还有一种做法用尺取法的思想,对暴力方法优化,对询问点排序后再扫描一遍,花开+1,花谢-1.详细看代码. 收获:一题收获很多:1. 降低复杂度可以用二分 2. 线段计数问题可以在端点标记1和-1 3. 离散化+线段树 终于会了:) (听说数据很水?) 代码1:离散化+线段树…
题目 题意: n(n<=10000) 个人依次贴海报,给出每张海报所贴的范围 li,ri(1<=li<=ri<=10000000) .求出最后还能看见多少张海报. 思路: 由于 li ri 都比较大,所以用离散化压缩一下空间,这里可以把所有的 li ri 都放在一个结构体数组 b[i] 中排序 再离散化. 不同的人涂的不同颜色的海报,颜色分别用1-n标记. add数组就是Lazy数组. 1. 涂第一种颜色所有节点 rt  ,都使它的add[rt]为当前颜色,说明这个节点包含的左右区…
链接:https://ac.nowcoder.com/acm/contest/992/B来源:牛客网 题目描述 在之前很火的一个动漫<干物妹小埋>中,大家对小埋打游戏喝可乐的印象十分的深刻. 现在欧尼酱将小埋的快乐水全部分开藏在了家具的顶端. 小埋使出空中1080°转身接战术翻滚跳到任一家具上,她相信,只要她翻滚的足够快,欧尼酱就跟不上她.   1.为获取梦幻开局,小埋一套技能可以使她一开始掉落在任一家具上. 2.小埋家的家具按顺序给出,每个家具可跳可不跳,为避开欧尼酱的追击,小埋翻滚到某个家…
传送门:http://bailian.openjudge.cn/practice/2528?lang=en_US //http://poj.org/problem?id=2528 题意: 给你n长海报,每张海报在墙上贴的区间范围是l,r 问你这n张海报贴完后,可以看见的海报数量是多少 题解: 离散化+线段树 因为l,r的数据范围是1e7,而题目只给了64MB的空间,直接存的话空间会炸掉,所以需用用到离散化的技巧 然后按照端点单点更新即可 现在重新写这题发现这个题坑点在于每一个点他都代表一个长度为…
The 2014 ACM-ICPC Asia Mudanjiang Regional Contest A.Average Score B.Building Fire Stations C.Card Game D.Domination E.Excavator Contest F.Fiber-optic Network G.Garden and Sprinklers H.Hierarchical Notation I.Information Entropy J.Jacobi Pattern K.Kn…
The 2014 ACM-ICPC Asia Mudanjiang Regional Contest 题目链接 没去现场.做的网络同步赛.感觉还能够,搞了6题 A:这是签到题,对于A堆除掉.假设没剩余在减一.B堆直接除掉 + 1就能够了 B:二分贪心,二分长度.然后会发现本质上是在树上最长链上找两点,那么有二分出来的长度了,就从两端分别往里移动那么长,那两个位置就是放置位置.然后在推断一下就能够了 D:概率DP.首先知道放一个棋子.能够等价移动到右上角区域,那么就能够dp[x][y][k],表示…
Conquer a New Region Time Limit: 5 Seconds      Memory Limit: 32768 KB The wheel of the history rolling forward, our king conquered a new region in a distant continent. There are N towns (numbered from 1 to N) in this region connected by several road…
2019-2020 ICPC, Asia Jakarta Regional Contest (Online Mirror, ICPC Rules, Teams Preferred) easy: ACEGHK medium-easy: BJL medium: D ?????: I A. B. C. 对 \(R[],C[]\) 分别按奇偶性分段. 网! D. 考虑 check 一个串,枚举右走对应的前缀 pre,下走对应的后缀 suf. 把每行反串拼接中间连特殊字符,建 SA,能 match 上 p…
摘要 本文主要给出了2018 ACM-ICPC Asia Beijing Regional Contest的部分题解,意即熟悉区域赛题型,保持比赛感觉. Jin Yong’s Wukong Ranking List 题意 输入关系组数n和n组关系,每组关系是s1 > s2,问第一出现矛盾的组,或者没有矛盾就输出0. 解题思路 第一感觉是拓扑排序,未完,又写了一个深搜的传递闭包,1 A,和2018年河南省赛的题很像. 代码 #include <cstdio> #include <ma…