A. Hongcow Learns the Cyclic Shift 题目连接: http://codeforces.com/contest/745/problem/A Description Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Being a dutiful student, he immediately learns how t…
A. Letters Cyclic Shift time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output You are given a non-empty string s consisting of lowercase English letters. You have to pick exactly one non-empty su…
A. Letters Cyclic Shift 题目连接: http://www.codeforces.com/contest/708/problem/A Description You are given a non-empty string s consisting of lowercase English letters. You have to pick exactly one non-empty substring of s and shift all its letters 'z'…
Largest Smallest Cyclic Shift 题目来源: Atcoder Code Festival 2017 Qual B Problem F 题目大意: 有\(X\)个字符'a',\(Y\)个字符'b',\(Z\)个字符'c'.用它们组成字符串,求最小表示的最大值. 思路: 贪心.首先将所有由单个字符构成的字符串插入到一个multiset<string>中,每次选取最小串\(s\)和最大串\(t\).此时最小表示一定是由\(s\)开头的,而将\(t\)接在\(s\)后面可以让…
You are given a non-empty string s consisting of lowercase English letters. You have to pick exactly one non-empty substring of s and shift all its letters 'z' 'y' 'x' 'b' 'a' 'z'. In other words, each character is replaced with the previous characte…
传送门 题意:给你x个a,y个b,z个c,显然这些字符可以拼成若干字符串,然后求这些字符串中最小表示法表示出来的最大的那一个. 解法:贪心思想,用multiset维护现在拼成的字串,每次取一个最小的和一个最大的拼在一起,最后剩下的就是答案. 代码如下: #include<bits/stdc++.h> using namespace std; int a,b,c; multiset<string>s; int main(){ scanf("%d%d%d",&…
题目大意:给你\(A\)个a,\(B\)个b,\(C\)个c,要你构造一个字符串,使它的最小循环表示法最大.求这个表示法.解题思路:不知道怎么证,但把a.b.c当做单独的字符串扔进容器,每次把字典序最小的和字典序最大的两个字符串合并就是答案.容器用multiset即可. C++ Code: #include<cstdio> #include<set> #include<string> using namespace std; multiset<string>…
Little Elephant and Chess Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 259A Description The Little Elephant loves chess very much. One day the Little Elephant and his friend decided…
C. Little Elephant and Shifts Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset/problem/220/C Description The Little Elephant has two permutations a and b of length n, consisting of numbers from 1 to n, inclusive. Let's de…
D. Serega and Fun Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/455/problem/D Description Serega loves fun. However, everyone has fun in the unique manner. Serega has fun by solving query problems. One day Fedor came up w…
B. Queries on a String Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/598/problem/B Description You are given a string s and should process m queries. Each query is described by two 1-based indices li, ri and integer ki. I…
C. Letters Cyclic Shift time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output You are given a non-empty string s consisting of lowercase English letters. You have to pick exactly one non-empty su…
题目链接:http://codeforces.com/contest/731/problem/D D. 80-th Level Archeology time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Archeologists have found a secret pass in the dungeon of one of t…
A. Friends Meeting time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Two friends are on the coordinate axis Ox in points with integer coordinates. One of them is in the point x1 = a, another…
A. Hongcow Learns the Cyclic Shift time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Bein…
敲完三题挂机一小时..... 也没懂DE什么意思 rank600上了一波分... A. Hongcow Learns the Cyclic Shift 给一个字符串,每次可以把最后一个字符拿到开头 问能形成多少种.. 暴力模拟 set去重... B. Hongcow Solves A Puzzle 判断矩形即可... C. Hongcow Builds A Nation 并查集求最大块 然后把未标记的块放进最大块里 最后的连边数-最初的 为我们添加的最多可能 D. Hongcow…
Description You are given an array a of size n, and q queries to it. There are queries of two types: 1 li ri — perform a cyclic shift of the segment [li, ri] to the right. That is, for every x such that li ≤ x < ri new value of ax + 1 becomes equal t…
Serega loves fun. However, everyone has fun in the unique manner. Serega has fun by solving query problems. One day Fedor came up with such a problem. You are given an array a consisting of n positive integers and queries to it. The queries can be of…
A. Hongcow Learns the Cyclic Shift time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Hongcow is learning to spell! One day, his teacher gives him a word that he needs to learn to spell. Bein…
E. Little Elephant and Shifts time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output The Little Elephant has two permutations a and b of length n, consisting of numbers from 1 to n, inclusive. Le…
D. Serega and Fun time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Serega loves fun. However, everyone has fun in the unique manner. Serega has fun by solving query problems. One day Fedor…