Codeforces Round #129 (Div. 2) A】的更多相关文章

A. Little Elephant and Rozdil 求\(n\)个数中最小值的个数及下标. B. Little Elephant and Sorting \[\sum_{i=1}^{n-1}{max(0, a_i-a_{i+ 1})}\] C. Little Elephant and Interval 问题转化成求\([1,n]\)范围内满足题意的数的个数. 假设\(n\)的位数为\(L\),当\(L \gt 2\)时,若\(x\)的位数小于\(L\),则除了首位和末位以外,其余位任意取…
E. Little Elephant and Strings time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output The Little Elephant loves strings very much. He has an array a from n strings, consisting of lowercase Englis…
题意:有n个串,询问每个串有多少子串在n个串中出现了至少k次. 题解:sam,每个节点开一个set维护该节点的字符串有哪几个串,启发式合并set,然后在sam上走一遍该串,对于每个可行的串,所有的fail都是可行的直接加上len,不可行就往fail上跳. 被for(int i=0;s[i];i++)给骚死了,一直tle.... //#pragma GCC optimize(2) //#pragma GCC optimize(3) //#pragma GCC optimize(4) //#prag…
Description The Little Elephant very much loves sums on intervals. This time he has a pair of integers l and r (l ≤ r). The Little Elephant has to find the number of such integers x (l ≤ x ≤ r), that the first digit of integer x equals the last one (…
Description The Little Elephant loves sortings. He has an array a consisting of n integers. Let's number the array elements from 1 to n, then the i-th element will be denoted as ai. The Little Elephant can make one move to choose an arbitrary pair of…
Description The Little Elephant loves Ukraine very much. Most of all he loves town Rozdol (ukr. "Rozdil"). However, Rozdil is dangerous to settle, so the Little Elephant wants to go to some other town. The Little Elephant doesn't like to spend m…
Educational Codeforces Round 129 (Rated for Div. 2) A-D A 题目 https://codeforces.com/contest/1681/problem/A 题解 思路 知识点:贪心. 先手的一方拥有大于等于对方最大牌的牌即可获胜,所以考虑取两组牌各自的最大值进行比较. 时间复杂度 \(O(n)\) 空间复杂度 \(O(1)\) 代码 #include <bits/stdc++.h> #define ll long long using…
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate it n = int(raw_input()) s = "" a = ["I hate that ","I love that ", "I hate it","I love it"] for i in ran…
Codeforces Round #354 (Div. 2) Problems     # Name     A Nicholas and Permutation standard input/output 1 s, 256 MB    x3384 B Pyramid of Glasses standard input/output 1 s, 256 MB    x1462 C Vasya and String standard input/output 1 s, 256 MB    x1393…
直达–>Codeforces Round #368 (Div. 2) A Brain’s Photos 给你一个NxM的矩阵,一个字母代表一种颜色,如果有”C”,”M”,”Y”三种中任意一种就输出”#Color”,如果只有”G”,”B”,”W”就输出”#Black&White”. #include <cstdio> #include <cstring> using namespace std; const int maxn = 200; const int INF =…