第一问求最长下降子序列,不提; 第二问:借鉴了最短路的方法??? 我们求出来了每个位置的最长下降子序列的长度,那么刻意这样这样转移 if f[i]==f[j]+1&&a[i]<a[j](i>j) 这代表f[i]可以由f[j]转移过来,所以 f[i]+=f[j] 但是会重复,所以当f[i]==f[j] ...
分类:
其他好文 时间:
2019-04-28 12:41:48
阅读次数:
110
[题目链接] https://www.lydsy.com/JudgeOnline/problem.php?id=4319 [算法] 首先 , 我们可以求出这个字符串的rank数组 按照SA逐位枚举 , 贪心构造 , 即可 时间复杂度 : O(N) [代码] ...
分类:
其他好文 时间:
2019-04-27 13:09:54
阅读次数:
136
题目描述: bz luogu 题解: 裸的基环树直径。 代码: #include<queue> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; typedef long long ll; cons ...
分类:
其他好文 时间:
2019-04-27 00:49:19
阅读次数:
191
题面太长 手残把n打成m 1 void read() 2 { 3 red(n); 4 red(m); 5 memset(v,0x3f,sizeof(v)); 6 for(int i=1;i<=m;++i) 7 { 8 red(x); 9 red(p); 10 red(q); 11 if(q) 12 ...
分类:
其他好文 时间:
2019-04-26 17:49:44
阅读次数:
122
https://www.luogu.org/problemnew/show/P4171 意识到图中只有两种不同的菜系:满和汉 并且检查员类似于一个约束,可以发现这就是一个2-sat模型,满和汉分别对应true和false 由于只是检查可行性,只需要判断存在点的true个false存在同一个强连通分量 ...
分类:
Web程序 时间:
2019-04-26 14:46:42
阅读次数:
142
D - Arpa’s letter-marked tree and Mehrdad’s Dokhtar-kosh paths 思路: 树上启发式合并 从根节点出发到每个位置的每个字符的奇偶性记为每个位置的状态,每次统计一下每个状态的最大深度 为了保证链经过当前节点u,我们先计算每个子树的答案,再更新 ...
分类:
其他好文 时间:
2019-04-26 13:21:07
阅读次数:
165
[TOC] 2018 2019 ICPC, NEERC, Southern Subregional Contest (Codeforces 1070) "比赛链接" ~~B题看不懂样例= =其它题咕咕了。~~ A.Find a Number(BFS) 先要想到令$f[i][j]$表示模$d$余数为$ ...
分类:
其他好文 时间:
2019-04-26 09:44:08
阅读次数:
149
#include<stdio.h>void main(){ char a,b,c,d,e; a=getchar(); b=getchar(); c=getchar(); d=getchar(); e=getchar(); putchar(a); putchar(b); putchar(c); put ...
分类:
其他好文 时间:
2019-04-25 16:18:04
阅读次数:
151
1. #include "stdafx.h" #include <stdio.h> int main(int argc, char* argv[]) { char a,b,c,d; a = getchar(); b = getchar(); c = getchar(); d = getchar(); ...
分类:
其他好文 时间:
2019-04-25 16:08:16
阅读次数:
154
#include<stdio.h> int main(){ char a,b,c,d,e; a=getchar(); b=getchar(); c=getchar(); d=getchar(); e=getchar(); putchar(a); putchar(b); putchar(c); put ...
分类:
其他好文 时间:
2019-04-25 14:40:09
阅读次数:
133