- 博客(87)
- 资源 (1)
- 收藏
- 关注
原创 2018 区域赛前训练
BZOJ[Ceoi2018]Global warming考虑转换问题,对于一个区间 [l,r] 的增加,等价于对 [l,n]的增加。对于一个区间 [l,r] 的减少,可以等价于对 (r,n] 的增加。因此问题转换为对于一个序列, 可以对 [x,n] 的位置都增加一个值 y,在这种情况下的 LIS 最大值。因此前后分别求一下 LIS 即可。...
2018-10-22 15:39:43 244
原创 2017 CCPC - Online
A. Vertex Cover [zmy]二分图,贪心构造。B. Party [zmy]对于每个询问我们处理一遍。首先有一个这样的性质:如果纸上写了男生集合XX,女生集合YY,如果XX在YY在gig_i倍数的子图中均存在一个完备匹配,那么一定存在一种扩充集合方案X⊆X′,Y⊆Y′X \subseteq X',Y \subseteq Y',证明显然。方案数为左边存在完备匹配的集合XX的个数乘以右边存在
2017-09-13 14:28:13 528
原创 2017 ACM/ICPC Asia Regional Urumqi Online
A. Banana [wbr]三层for循环。B. Out-out-control cars [wbr]很简单的计算几何,换算成相对参考系之后就是判断射线与线段相交的老套问题。有两个坑点:其一是开始时刻可能重叠。其二是double会爆精度。好在全程叉积运算,可以用long long。C. Coconut [zmy]按题意模拟D. Hack Portals [jds]dp,需要发现最后未完成的点总是中
2017-09-12 23:56:35 681
原创 2017 Multi-University Training Contest - Team 9
A. Big binary tree [zmy]每次修改一个点,修改其父亲所有节点的mx[x]mx[x]值,即向下走的最大距离。查询时,我们考虑 dp 的过程,先计算两个子树的结果,然后再向上推,计算向上路径的最大长度。思路比较简单。但是代码技巧很多。对于一个没有被更新过的节点vv,假设其向左扩展的最大深度为xx,向右扩展的最大深度为yy。那么如果x!=yx!=y,则最长路径一定是v−>nv ->
2017-08-31 10:57:46 314 1
原创 2017 ACM暑期特训
upd 所有代码可以参见我的github:https://github.com/xaphoenix/codeforcescodeforces现在已经完成:6Round 422Div2A I’m bored with life 水题 Div2B Crossword solving 水题 Div2C Hacker, pack your bags! vector乱搞下就行了 Div2D My p
2017-07-10 20:31:51 401
原创 C++ 21 —— 异常
源码// 21Exceptions.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"//exception: 程序运行过程中,由于资源、环境等变化导致的不可预知因素//注意. bug不是exception,exception是程序员不可控制的,
2017-06-11 17:17:22 414
原创 C++ 20 —— STL
源码// 20STL.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"#include "vector"using namespace std;int main(int argc, char* argv[]){ vector<int
2017-06-11 17:15:29 537
原创 C++ 19 —— 模板
源码 // 19Template.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"template <class T>class Stack{ int top; T pool[100];public: Stack(
2017-06-11 17:13:04 736
原创 C++ 18 —— 抽象类
源码// 18Poly_Interface.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"class FlyObject{public: virtual void Fly() = 0;};class Machine{};cla
2017-06-11 17:07:05 600
原创 C++ 17 —— 纯虚函数
源码// 17Ploy_PureVirtual.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"class Pet{public: void Speak() = 0; //问题1. 对于Pet类,存在一个纯虚函数,那么Pet
2017-06-11 17:04:57 510
原创 C++ 16 —— 虚函数
源码// 16Poly_Virtual.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"class Pet{public: virtual void Speak(){}};class Dog : public Pet{publ
2017-06-11 16:54:51 397
原创 C++ 15 —— 多态
源码// 15Poly_Upcasting.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"class Pet{public: void Speak(){}};class Dog : public Pet{public:
2017-06-11 00:53:40 408
原创 C++ 14 —— 私有继承
源码// 14Inhe_private.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"class Base{public: void fun1(){}};class Derived : Base//私有继承{};int ma
2017-06-11 00:46:59 380
原创 C++ 13 —— 多重继承
源码// 13Inhe_Multiple.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"class Base1{public: void fun1(){}};class Base2{public: void fun2(
2017-06-11 00:40:14 355
原创 C++ 12 —— 初始化顺序
源码// 12Inhe_Init_list.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"class Base{protected: int i;public: Base(int ai):i(ai){}};class D
2017-06-11 00:27:31 371
原创 C++ 11 —— 继承
源码// 11Inhe_Concept.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"//考虑一个场景,图书馆有很多书(book),其中,很多事技术类现代书籍(TechBook),也有珍贵的历史文献(HisBook)//如果一本书丢了,都要进
2017-06-11 00:13:01 443
原创 C++ 10 —— 重载
源码// 10OpOverloading.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"class Account{ int balance;public: Account():balance(0){} void S
2017-06-11 00:11:32 407
原创 C++ 09 —— NewDelete
源码// 09NewDelete.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"#include "stdlib.h"class Test{ int *p;public: Test() { p =
2017-06-11 00:04:50 355
原创 C++ 08 —— Const
源码// 08Const.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"//1. const & parametervoid fun(int* p1,const int* p2){}//问题:两个参数暗含什么含义?//2. const fu
2017-06-10 23:57:39 366
原创 C++ 07 —— static
源码// 07Static.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"//1. static local varclass Test{public: Test() { cout << "construc
2017-06-10 23:49:06 364
原创 C++ 06 —— 拷贝构造函数
源码// 06CopyConstructor.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"class Test{ int i; int *p;public: Test(int ai,int value) {
2017-06-10 23:37:23 389
原创 C++ 05 —— 析构函数
源码// 05Destructor.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"class Test{ int i; int *p;public: Test(int ai) { i = ai
2017-06-10 23:25:02 538 3
原创 C++ 04 —— 构造函数
源码// 04Constructor.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"class Test{ int i; int j;public: //class 内部,默认存在一个构造函数,形如以下,但是,一旦人
2017-06-10 23:17:50 340
原创 C++ 03 —— this
源码// 03This.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"class Test{ int i; int j;public: void SetI(int ai) { cout <<
2017-06-10 22:48:27 320
原创 C++ 02 —— 访问权限
源码// 02AccessControl.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "iostream.h"class Test{//通常,将data member标注成private,外部不能访问//private可以省略,class内部默认为privat
2017-06-10 22:40:31 544 2
原创 C++ 01 —— 重载
C++明天考试,复习一波重载的作用域我们参考下C++primer上的例子string read();void print(const string&);void print(double);void fooBar(int ival){ bool read = false; string s = read(); void print(int); print("V
2017-06-10 22:18:22 1238
原创 实验吧 RE 题解
babyCrack利用PEID发现是.NET程序,没有加壳,直接用IDA查看 得到key hctf{bABy_CtsvlmE_!}阿拉丁神灯利用PEID发现是.NET程序,没有加壳,直接用IDA查看 将这串字符输入到页面中,得到key UnPack&Crack2011!!证明自己吧利用PEID发现是C程序,没有加壳,直接用IDA查看 先F5 main函数 显然判断密码
2017-06-01 13:00:27 2240
原创 一个简易的shell
#include<stdio.h>#include<stdlib.h>#include<unistd.h>#include<pwd.h>#include<sys/types.h>#include<sys/stat.h>#include<fcntl.h>#define MAXLEN 1000void swap(int *a, int *b){ int t = *a; *a
2017-05-30 21:49:49 235
原创 hackinglab 脚本关 writeup
key又又找不到了先点开通关地址 之后点击这个链接,拦截它的response,可以得到key 快速口算写个脚本就行了。利用正则来提取相关信息。import requestsimport reurl = 'http://lab1.xseclab.com/xss2_0d557e6d2a4ac08b749b61473a075be1/index.php'header = {'Cookie':
2017-05-28 22:27:44 3162
原创 Codeforces Round #414 (Div1+Div2) G Replace All (组合数学)
考虑给定两个M、N串的情况: 定义:两个01串S,T(|S|≤|T|)S,T(|S|\leq|T|)是coprimecoprime的当且仅当S=TS=T。或者如果SS是TT的一个前缀,并令T=S+XT=S+X,如果S,XS,X是coprimecoprime的,那么S,TS,T也是coprimecoprime的。引理1:如果两个串S,T(|S|≤|T|)S,T(|S|\leq|T|)是coprime
2017-05-24 17:21:22 550
原创 hdu1506 Largest Rectangle in a Histogram (笛卡尔树)
传送门:http://acm.hdu.edu.cn/showproblem.php?pid=1506标解应该是DP。不过这里可以当做笛卡尔树模板题来做。笛卡尔树的构造方式为:首先我们按照横坐标从左往右进行处理,同时维护一个单调栈,保证栈里的元素高度递增。每次进来一个新的节点时,将栈里比它高的元素都弹出,并将它的左儿子设为最后一个弹出的节点,而且将先弹出的节点设为它之后弹出的那个节点的右儿子即可。为了
2017-05-12 09:17:45 449
原创 bzoj2820 YY的 (莫比乌斯函数)
枚举质数pp,可以得到 ∑p=1min(n,m)∑t=1min(n/p,m/p)μ(t)[n/pt][m/pt]\sum _{p=1} ^{min(n,m)} \sum _{t=1}^{min(n/p,m/p)} \mu (t) [\frac{n/p}{t}][\frac{m/p}{t}] 令T=ptT=pt,原式可以化为 ∑T=1min(n,m)[nT][mT]∑p|Tμ(Tp)\sum _
2017-05-09 18:45:53 398
原创 bzoj2301 [HAOI2011]Problem b (莫比乌斯函数)
首先可以想到分为四个前缀区间进行加加减减,考虑[1,a],[1,b][1,a],[1,b]这组: ∑i=1a∑j=1b[gcd(i,j)==k]\sum _{i=1}^{a} \sum_{j=1}^{b}[gcd(i,j)==k] =∑i=1a/k∑j=1b/k[gcd(i,j)==1]=\sum _{i=1}^{a/k} \sum_{j=1}^{b/k}[gcd(i,j)==1] =∑i=1
2017-05-09 17:35:26 351
原创 bzoj2986 Non-Squarefree Numbers (莫比乌斯函数)
传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=2986 首先能想到二分答案,然后判断1~X中有多少个squarefree,这里用莫比乌斯函数来容斥即可。#include<cstdio>#include<cstring>#include<cstdlib>#include<cmath>#include<iostream>#includ
2017-05-09 16:57:33 226
原创 bzoj4521 [Cqoi2016]手机号码 (数位DP)
dp[len][last][num][f4][f8][cur][pp]dp[len][last][num][f4][f8][cur][pp]。lenlen表示当前长度,lastlast表示上一个数字,numnum表示当前连续相同数字的长度,f4f4表示是否出现过44,f8f8表示是否出现过88,curcur表示是否沿着上界,pppp表示是否完成过连续33个相同数字。#include<cstdio>
2017-05-09 12:00:32 234
原创 bzoj3652 大新闻(数位DP)
传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=3652第一问只用统计出所有位1的个数即可。第二问我们用记忆化搜索。dp[len][cur][l]表示当前长度为len。若cur为1,则表示当前随机生成的数沿着上界。若l为1,则表示当前构造的数沿着上界。这种状况下答案的值。转移显然。#include<cstdio>#include<cstrin
2017-05-09 10:48:31 380
原创 bzoj1977 [BeiJing2010组队]次小生成树 Tree
在普通次小生成树的基础上再维护一个树上严格次大值即可。#include<cstdio>#include<cstring>#include<cstdlib>#include<iostream>#include<cmath>#include<algorithm>#include<set>#include<map>#include<queue>#include<stack>#inclu
2017-05-06 22:34:19 222
原创 bzoj3039 玉蟾宫 (悬线法)
参考《浅谈用极大化思想解决最大子矩形问题》–王知昆#include<cstdio>#include<cstring>#include<cstdlib>#include<iostream>#include<cmath>#include<algorithm>#include<set>#include<map>#include<queue>#include<stack>#include
2017-05-06 19:58:27 313
博弈论小结by xaphoenix
2016-04-25
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人