A

水题

B

直接看2,发现`unordered_map被卡了。。。`

乖乖离散化

C

有六种水管,可以任意的旋转,使得有一条从(1, 0)到(2, n)的通路。

找规律,当时写D没来得及看

 #include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<queue>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<bitset> using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
#define pb(x) push_back(x)
#define cls(x, val) memset(x, val, sizeof(x))
#define fi first
#define se second
#define mp(x, y) make_pair(x, y)
#define inc(i, l, r) for(int i=l; i<=r; i++)
const int inf = 0x3f3f3f3f;
const int maxn = +;
int n;
string s[]; int main(){
ios::sync_with_stdio(false);
int _;
cin>>_;
while(_--){
cin>>n;
cin>>s[]>>s[];
int row=;
int pos = ;
for(pos=; pos<n; pos++){
if(s[row][pos]>=''){
if(s[row^][pos]<'') break;
else {
row ^= ;
}
}
//cout<<row<<" "<<pos<<endl;
}
//cout<<"lst "<<row<<" "<<pos<<endl;
if(row == &&pos == n){
cout<<"YES"<<endl;
}else cout<<"NO"<<endl;
} return ;
}

D

很裸的线段树,第一次正式的比赛AC了线段树,虽然很裸。。。

E

看起来很复杂的算式计算,不想补了。。

F SOS dp

原题意:

给一个字符串,长度可达1e6,最多翻转一个子串,使得最后选择一个子串,使得该子串包含的不同的字母的个数最大。

题意转换:

找两个不想交的子串,使得不相同的子串的个数最多。

1. 计算所有的子串的最大个数

2. 更新所有的集合i中包含的不同字母的最大个数。(dp[i]表示i的子集中的最大不同字母个数)

3. $ans = max(ans, dp[i]+dp[i \quad xor \quad all])$

 #include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<queue>
#include<cmath>
#include<map>
#include<stack>
#include<set>
#include<bitset> using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
#define pb(x) push_back(x)
#define cls(x, val) memset(x, val, sizeof(x))
#define fi first
#define se second
#define mp(x, y) make_pair(x, y)
#define inc(i, l, r) for(int i=l; i<=r; i++)
const int inf = 0x3f3f3f3f;
const int maxn = 1e6+; int n, m, k; char s[maxn]; int dp[<<]; int main(){
while(~scanf("%s",s+)){
n = strlen(s + );
for(int i=;i<=n;i++) s[i] -= 'a'; memset(dp,,sizeof(dp));
for(int i=;i<=n;i++){
int x = , c = ;
for(int j=i;j<=n;j++){
if((x >> s[j]) & ) break;
x |= ( << s[j]); c++;
dp[x] = c;
}
} for(int i=;i<;i++){
for(int mask=;mask<(<<);mask++){
if((mask>>i)&){
//原来是仅有的几个状态被覆盖到了,现在是全部有覆盖一遍。
//i表示的集合是i的子集。
dp[mask] = max(dp[mask],dp[mask^(<<i)]);
}
}
} int ans = , all = (<<) - ;
for(int i=;i<(<<);i++){
ans = max(ans, dp[i] + dp[all^i]);
}
printf("%d\n",ans);
}
return ;
}

cf1234-div3的更多相关文章

  1. Codeforces #550 (Div3) - G.Two Merged Sequences(dp / 贪心)

    Problem  Codeforces #550 (Div3) - G.Two Merged Sequences Time Limit: 2000 mSec Problem Description T ...

  2. codeforces-1144 (div3)

    赛后经验:div3过于简单,以后不做了 A.存在以下情况即为NO 1.存在相同字母 2.最大字母-最小字母 != 字符串长度 #include <map> #include <set ...

  3. 12.27 cf div3 解题报告

    12.27 cf div3 解题报告 wxy.wxy,带上分拉,全场做了个无脑小白 比赛场地 A: T1,跟着模拟就好了 B: sort一遍之后 去除的数一定是a[1]或者a[n] 比较去除谁小就输出 ...

  4. CodeForces 1029E div3

    题目链接 第一道场上自己做出来的E题...虽然是div3,而且是原题... 当时做完ABC,D题没有思路就去怼E了,然后发现貌似原题? 事实上就是原题... 给个原题链接... [HNOI2003]消 ...

  5. CodeForces Round #527 (Div3) B. Teams Forming

    http://codeforces.com/contest/1092/problem/B There are nn students in a university. The number of st ...

  6. 【赛时总结】◇赛时·V◇ Codeforces Round #486 Div3

    ◇赛时·V◇ Codeforces Round #486 Div3 又是一场历史悠久的比赛,老师拉着我回来考古了……为了不抢了后面一些同学的排名,我没有做A题 ◆ 题目&解析 [B题]Subs ...

  7. Codeforces Round #535 (Div. 3) [codeforces div3 难度测评]

    hhhh感觉我真的太久没有接触过OI了 大约是前天听到JK他们约着一起刷codeforces,假期里觉得有些颓废的我忽然也心血来潮来看看题目 今天看codeforces才知道居然有div3了,感觉应该 ...

  8. CodeForces Round#480 div3 第2场

    这次div3比上次多一道, 也加了半小时, 说区分不出1600以上的水平.(我也不清楚). A. Remove Duplicates 题意:给你一个数组,删除这个数组中相同的元素, 并且保留右边的元素 ...

  9. codeforces #579(div3)

    codeforces #579(div3) A. Circle of Students 题意: 给定一个n个学生的编号,学生编号1~n,如果他们能够在不改变顺序的情况下按编号(无论是正序还是逆序,但不 ...

  10. CF598: div3解题报告

    CF598:div3解题报告 A: Payment Without Change 思路: 按题意模拟即可. 代码: #include<bits/stdc++.h> using namesp ...

随机推荐

  1. Vue2.0史上最全入坑教程(上)—— 搭建Vue脚手架(vue-cli)

    ps: 想了解更多vue相关知识请点击VUE学习目录汇总 Vue作为前端三大框架之一截至到目前在github上以收获44,873颗星,足以说明其以悄然成为主流.16年10月Vue发布了2.x版本,经过 ...

  2. HDU - 1724 Ellipse 自适应辛普森模板

    OJ 题解传送门 //Achen #include<algorithm> #include<iostream> #include<cstring> #include ...

  3. 来自 Spring Cloud 官方的消息,Spring Cloud Alibaba 即将毕业

    2019 年 7 月 24 日晚,Spring Cloud 官方发布公告: 仓库迁移是官方决定 Spring Cloud Alibaba 即将毕业 根据官方最新的发版规则,我们会把孵化器中的 Spri ...

  4. Codeforces 439C

    题目链接 比赛时间没能通过==, 只能说明自己代码写的太不严谨咯! 解题思想就是贪心 先判断无解的情况: 1. 奇数不够,因为偶数是无法凑成奇数的 2. 偶数不够,2个奇数可以凑成一个偶数 3. 在奇 ...

  5. The World's Top 15 Stock Exchanges by Domestic Market Capitalization

     The World's Top 15 Stock Exchanges by Domestic Market Capitalization in 2008 4 Euronext Belgium, Fr ...

  6. 深入理解 Node.js 进程与线程

    原文链接: https://mp.weixin.qq.com/s?__biz=MzAxODE2MjM1MA==&mid=2651557398&idx=1&sn=1fb991da ...

  7. 对快速排序的分析 Quick Sort

    快速排序 快排的基本思想是:通过一趟排序将待排记录分割成独立的两部分,其中一部分记录的关键字均比另一部分记录的关键字小,则可分别对这两部分记录继续进行排序,以达到整个序列有序.通常可选第一个记录为基准 ...

  8. Spring+Stomp+ActiveMq实现websocket长连接

    stomp.js+spring+sockjs+activemq实现websocket长连接,使用java配置. pom.xml(只列出除了spring基本依赖意外的依赖,spring-version为 ...

  9. blogbeta1

    //html <!DOCTYPE html> blog 身高:170 体重:230 座右铭 再给我吃一口 关于我 微信 微博 标签 SM SP 重金求爹 2019/11/16 本人找爹,带 ...

  10. Django-2.2.1版本关于无法使用makemigrations的错误

    报错 django.core.exceptions.ImproperlyConfigured: mysqlclient 1.3.13 or newer is required; you have 0. ...