Codeforces Round #445】的更多相关文章

题目链接: http://codeforces.com/contest/889/problem/C 题意: 给你 \(n\)和 \(k\). 让你找一种全排列长度为\(n\)的 \(p\),满足存在下标 \(i\),\(p_i\)大于所有 \(p_j\),\(j\epsilon[1,i-1]\)同时大于所有\(p_i\),\(j\epsilon[i+1,i+k]\).问你满足这样条件的排列有多少种? 题解: 设\(dp[i]\)表示以 \(i\) 结尾的,满足题目要求的\(1\) ~ \(i\)…
A:每次看是否有能走回去的房间,显然最多只会存在一个,如果有走过去即可,否则开辟新房间并记录访问时间. #include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> #include<cstring> #include<algorithm> using namespace std; #define ll long long #define N 200010…
D. Restoration of string time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A substring of some string is called the most frequent, if the number of its occurrences is not less than number of…
C. Petya and Catacombs time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output A very brave explorer Petya once decided to explore Paris catacombs. Since Petya is not really experienced, his explor…
B. Vlad and Cafes time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Vlad likes to eat in cafes very much. During his life, he has visited cafes n times. Unfortunately, Vlad started to feel t…
A. ACM ICPC time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output In a small but very proud high school it was decided to win ACM ICPC. This goal requires to compose as many teams of three as po…
ACM ICPC 每个队伍必须是3个人 #include<stdio.h> #include<string.h> #include<stdlib.h> #include<vector> #include<algorithm> using namespace std; int cmp(const void * x, const void * y) { //x < y : -; } ]; int main() { #ifndef ONLINE_…
[链接] 我是链接,点我呀:) [题意] 给你n个字符串. 让你构造一个字符串s. 使得这n个字符串. 每个字符串都是s的子串. 且都是出现次数最多的子串. 要求s的长度最短,且s的字典序最小. [题解] 如果s是出现最多的子串. 那么s的任意一个子串也都是出现次数最多的子串. 那么考虑"ab"这样一个子串. 则肯定要有字符'a'后面接的一定是'b' 且字符'b'前接的一定是'a' 不然'a'或'b'的出现次数一定会大于"ab"了. 则对于任意一个字符串s,在s[i…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 看看时间戳为i的点有哪些. 每次优先用已经访问过的点. 如果不行就新创一个点. 注意新创点的时间戳也是i. [代码] #include <bits/stdc++.h> using namespace std; const int N = 2e5; int n; int now = 1, tot = 1; vector <int> have[N + 10]; int before[N + 10]; int main(…
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 傻逼模拟 [代码] #include <bits/stdc++.h> using namespace std; const int N = 2e5; int n; int a[N+100]; int main(){ #ifdef LOCAL_DEFINE freopen("F:\\c++source\\rush_in.txt", "r", stdin); #endif for (int…