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. nodeJs基础方法

    Node.js 是一个基于Chrome javascript 运行时建立的一个平台, 用来方便地搭建快速的 易于扩展的网络应用 Node.js 借助事件驱动, 非阻塞I/O 模型变得轻量和高效, 非常 ...

  2. Fitnesse批量读取变量信息,并保存到用例执行上下文中

    Fitnesse变量可以分成两种,一种是自定义变量,另一种是用例执行过程中的临时变量. 在Finesse使用过程中,如果需要定义一些公共的变量,可以统一在一个文件中使用自定义变量的方法,将公共变量全部 ...

  3. 微信网页授权demo1

    要授权首先要网页域名授权 然后就index.php代码如下 <?php require_once("./function.php"); $url = 'http://'.$_ ...

  4. Vue--通过button跳转到其他组件并携带id参数

    一.创建vue文件 ’ <template> <div> goodsCommon<br/> goodsCommon<br/> goodsCommon&l ...

  5. C++学习笔记----4.4 继承情况下的类作用域嵌套

    引言: 在继承情况下,派生类的作用域嵌套在基类作用域中:如果不能在派生类作用域中确定名字,就在外围基类作用域中查找该名字的定义. 正是这种类作用域的层次嵌套使我们能够直接访问基类的成员,就好像这些成员 ...

  6. Python中输入和输出(打印)数据

    一个程序要进行交互,就需要进行输入,进行输入→处理→输出的过程.所以就需要用到输入和输出功能.同样的,在Python中,怎么实现输入和输出? Python3中的输入方式: Python提供了 inpu ...

  7. uni-app官方教程学习手记

    本人微信公众号:前端修炼之路,欢迎关注 背景介绍 大概在今年的十月份左右,我了解到Dcloud推出了uni-app.当时下载了一个Hbuilder X,下载了官方提供的hello示例教程.经过一番努力 ...

  8. pymysql.err.OperationalError: (2013, 'Lost connection to MySQL server during query')

    pymysql错误: pymysql.err.OperationalError: (2013, 'Lost connection to MySQL server during query') pymy ...

  9. 记一次goland的包导入问题

    昨天把go的GOPATH环境变量设置成了“/home/mi/app/gopath”,今天用goland新建的项目在/home/mi/go/src目录下,名字是studygolang,如下图. 结果导入 ...

  10. JVM学习篇章(一)

    熟悉Java开发的同学,应该都知道jvm是什么,---它就是Java虚拟机,今天我们就学习一下:  内存分配原则:  常用的监控命令