还剩四分钟的时候惊险过D(一直在模拟样例),这个出题风格有点像区域赛题(无论是题目的长度还是考察的侧重点...). A Ela Sorting Books 分析 每次贪心地取能取的最大字母即可. 代码实现 #include<iostream> #include<cstring> using namespace std; using LL = long long; int main(){ cin.tie(0); cout....
mex函数指的是第一个未出现的字符,那么我们可以这样构造。我们优先找大的字符,设为i,那么这一份内必须含有[a, i -1]的所有字符。因此我们在初始用一个桶维护出每个字符出现的次数,然后暴力贪心找最大字符即可,每次找完记得减去拿走的那一部分。 时间复杂度:O(n*26*26) 代码: bool check(int x) { if(x...
Dytechlab Cup 2022codeforces.com/contest/1737 A. Ela Sorting Books 题意:给定长度为n的字符串(字符a~y),需要将其分为k份(k整除n)。 用每一份缺失的最小字符代表每一份,重新组成一个字符串。问可以得到的最大字典序字符串是什么? 题解:贪心。每一个都应该尽量选取从a开始连续的字符,直到遇到一个...
A - Ela Sorting Books 先统计每个字母的数量, 然后枚举每一段, 然后从小到大枚举每一个字母, 缺少那个插入那个, 然后更新字母的数量即可 #include<bits/stdc++.h> #define x first #define y second #defi…
Tutorial of Dytechlab Cup 2022 editorial +38 magnified 2 years ago 124 Comments (106) Show archived | Write comment?low_ 2 years ago, # | 0 Auto comment: topic has been updated by low_ (previous revision, new revision, compare). → Reply Hamroz_JONN 2 years ago, # ^ | ...
↵ <spoiler summary="Solution (C++)">↵ ↵ ~~~↵ void execute(int test_number)↵ {↵ cin>>n>>k>>str;↵ vector <int> count_char(26, 0);↵ for (char c: str) count_char[c - 'a']++;↵ string ans = "";↵ for...
void solve() { int n, k; cin>>n>>k; string s; cin>>s; map<char, int> mp; for(auto it: s) mp[it]++; for(int i=1;i<=k;i++) { int cnt = 0; for(char j = 'a'; j <= 'z'; j++) { if(mp[j] > 0 && cnt < n/k) { cnt++; mp[j] --; } else { cout...
// use for instead of while to serve facebook hacker cup test format↵ {↵ execute(testno); // only start coding in this function, not in main↵ }↵}↵// Template by low_↵// Contact me via mail: ttuandung1803@gmail.com↵// ...or codeforces: www.codeforces.com/profil...
#include<bits/stdc++.h> using namespace std; typedef long long ll; #define int long long #define x first #define y second const int inf = 0x3f3f3f3, N = 2e5+10, mod = 1e9+7; const int M=1e7+1010; const ll INF = 0x3f3f3f3f3f3f3f3f; const double pi = acos(-1.0);...
Guangzhou Dyedtech Machinery Co.,Ltd - Professional Zipper dyeing and finishing equipment,Yarn dyeing and finishing equipment,Yarn dryer,Fabric dyeing and finishing equipment,Continuos dyeing machine and finishing equipment,Textile lab machinery supplier