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. loadrunner录制脚本时登录密码转md5

    在录制用户注册登录脚本时,常常会遇到web程序对用户密码进行加密处理.在很多时候采用的加密方式为MD5. 这时有两种处理方式: 一.所有用户采用同一密码 例如:每个用户名的密码都为e10adc3949 ...

  2. 杨柳絮-Info:菏泽多措并举治理杨柳絮 5年内实现“有絮不成灾”

    ylbtech-杨柳絮-Info:菏泽多措并举治理杨柳絮 5年内实现“有絮不成灾” 1.返回顶部 1. 菏泽多措并举治理杨柳絮 5年内实现“有絮不成灾” 2019年04月09日 11:44  来源:大 ...

  3. Spring Boot → 01:概要

    背景 大约20年前,程序员们使用“企业级Java Bean”(EJB)开发企业应用,需要配置复杂的XML. 在二十世纪初期,新兴Java技术——Spring,横空出世.使用极简XML和POJO(普通J ...

  4. Codeforces Round #197 (Div. 2) A. Helpful Maths【字符串/给一个连加计算式,只包含数字 1、2、3,要求重新排序,使得连加的数字从小到大】

    A. Helpful Maths time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...

  5. POJ 1845 (洛谷 :题目待添加)Sumdiv

    约数和 题目描述 给出a和b求a^b的约数和. 输入格式: 一行两个数a,b. 输出格式: 一个数表示结果对 9901 的模. Input 2 3 Output 15 SB的思路: 这是一道典型的数论 ...

  6. php怎么自动加载

    在 PHP 代码的顶部你是不是经常看到这样的代码. require 'lionis.php'; require 'is.php'; require 'cool.php'; 如果只是引入几个 PHP 脚 ...

  7. Linux常用命令6 压缩解压命令

    .zip是Linux和Windows共有的压缩格式 1.压缩解压命令:gzip 命令英文原意:GNU zip   命令所在路径:/bin/gzip 执行权限:所有用户 语法: gzip [文件]   ...

  8. CMake学习笔记三

    添加子文件夹 ADD_SUBDIRECTORY(hello) ADD_SUBDIRECTORY(libs) ADD_SUBDIRECTORY(VSLIB) SET(IDE_TARGET_NAME VS ...

  9. Directx11教程(13) D3D11管线(1)

    原文:Directx11教程(13) D3D11管线(1)       从本篇教程开始,我们暂停代码的学习,先来了解一下D3D11的管线,这些管线不涉及具体的硬件,而是着重于理解能够支持D3D11的管 ...

  10. MacOS局域网访问Windows7共享文件

    配置步骤 Windows7 进入[控制面板]-[网络和共享中心]-[高级共享设置] 启用网络发现 启用文件和打印机共享 选择要共享的文件或文件夹,点击[共享]-[特定用户] 选择Windows7当前登 ...