cf 766#
天呢,太垃圾了我。。
AB懵逼了半天题意,C最后搞了个DP还不对。。。DP太垃圾了,,
#include<bits/stdc++.h>
#define INF 0x7fffffff
#define LL long long
#define N 100005
using namespace std;
inline int ra()
{
int x=,f=; char ch=getchar();
while (ch<'' || ch>'') {if (ch=='-') f=-; ch=getchar();}
while (ch>='' && ch<='') {x=x*+ch-''; ch=getchar();}
return x*f;
}
int main()
{
string s1,s2; cin>>s1>>s2;
if (s1.length()!=s2.length())
{
if (s1.length()>s2.length())
cout<<s1.length();
else cout<<s2.length();
}
else
{
if (s1==s2) cout<<"-1";
else cout<<s1.length();
}
return ;
}
#include<bits/stdc++.h>
#define INF 0x7fffffff
#define LL long long
#define N 100005
using namespace std;
inline int ra()
{
int x=,f=; char ch=getchar();
while (ch<'' || ch>'') {if (ch=='-') f=-; ch=getchar();}
while (ch>='' && ch<='') {x=x*+ch-''; ch=getchar();}
return x*f;
}
int a[N];
int main()
{
int n=ra();
for (int i=; i<=n; i++) a[i]=ra();
sort(a+,a+n+);
for (int i=; i<=n-; i++)
{
if (a[i]+a[i+]>a[i+] && a[i+]-a[i]<a[i+])
{
cout<<"YES";
return ;
}
}
cout<<"NO";
return ;
}
/*#include<bits/stdc++.h>
#define INF 0x7fffffff
#define LL long long
#define N 100005
using namespace std;
inline LL ra()
{
LL x=0,f=1; char ch=getchar();
while (ch<'0' || ch>'9') {if (ch=='-') f=-1; ch=getchar();}
while (ch>='0' && ch<='9') {x=x*10+ch-'0'; ch=getchar();}
return x*f;
}
bool vis[1005][1005];
LL n,f[1005][1005],a[50],anslen;
char s[1005];
const LL mod=1e9+7;
int main()
{
n=ra(); scanf("%s",s+1);
for (LL i=0; i<26; i++) a[i]=ra();
LL mn=INF;
for (LL i=1; i<=n; i++)
{
mn=min(mn,a[s[i]-'a']);
if (mn<i) break;
f[i][1]=1;
vis[i][1]=1;
anslen=max(anslen,i);
}
for (LL i=1; i<=n; i++)
{
for (LL j=2; j<=i; j++)
{
LL mn=a[s[i]-'a'],cnt=1;
for (LL k=i-1; k>=1; k--,cnt++)
{
mn=min(mn,a[s[k]-'a']);
if (mn<cnt) break;
f[i][j]+=f[k][j-1];
if (vis[k][j-1]) vis[i][j]=1;
f[i][j]%=mod;
if (vis[k][j-1]) anslen=max(anslen,cnt);
}
}
}
LL anstot=0,ansnum;
for (LL i=1; i<=n; i++) anstot+=f[n][i],anstot%=mod;
cout<<anstot<<endl;
for (LL i=1; i<=n; i++)
if (f[n][i])
{
ansnum=i;
break;
}
cout<<anslen<<endl<<ansnum;
return 0;
}*/
#include<bits/stdc++.h>
#define INF 0x7fffffff
#define LL long long
#define N 100005
using namespace std;
inline LL ra()
{
LL x=,f=; char ch=getchar();
while (ch<'' || ch>'') {if (ch=='-') f=-; ch=getchar();}
while (ch>='' && ch<='') {x=x*+ch-''; ch=getchar();}
return x*f;
}
int f[N],n,dp[N],a[N],mx;
char s[N];
const int mod=1e9+;
bool check(int i, int j)
{
int l=j-i+;
for (int k=i; k<=j; k++)
{
if (a[s[k]-'a']<l)
return ;
}
return ;
}
int main()
{
n=ra(); scanf("%s",s+);
for (int i=; i<; i++) a[i]=ra();
memset(f,0x3f,sizeof(f));
dp[]=; f[]=;
for (int i=; i<=n; i++)
for (int j=; j<=i; j++)
if (check(i-j+,i))
{
dp[i]=(dp[i]+dp[i-j])%mod;
f[i]=min(f[i],f[i-j]+);
if (dp[i-]) mx=max(mx,j);
}
cout<<dp[n]<<endl;
cout<<mx<<endl;
cout<<f[n]<<endl;
}
cf 766#的更多相关文章
- ORA-00494: enqueue [CF] held for too long (more than 900 seconds) by 'inst 1, osid 5166'
凌晨收到同事电话,反馈应用程序访问Oracle数据库时报错,当时现场现象确认: 1. 应用程序访问不了数据库,使用SQL Developer测试发现访问不了数据库.报ORA-12570 TNS:pac ...
- cf之路,1,Codeforces Round #345 (Div. 2)
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... ...
- cf Round 613
A.Peter and Snow Blower(计算几何) 给定一个点和一个多边形,求出这个多边形绕这个点旋转一圈后形成的面积.保证这个点不在多边形内. 画个图能明白 这个图形是一个圆环,那么就是这个 ...
- ARC下OC对象和CF对象之间的桥接(bridge)
在开发iOS应用程序时我们有时会用到Core Foundation对象简称CF,例如Core Graphics.Core Text,并且我们可能需要将CF对象和OC对象进行互相转化,我们知道,ARC环 ...
- [Recommendation System] 推荐系统之协同过滤(CF)算法详解和实现
1 集体智慧和协同过滤 1.1 什么是集体智慧(社会计算)? 集体智慧 (Collective Intelligence) 并不是 Web2.0 时代特有的,只是在 Web2.0 时代,大家在 Web ...
- CF memsql Start[c]UP 2.0 A
CF memsql Start[c]UP 2.0 A A. Golden System time limit per test 1 second memory limit per test 256 m ...
- CF memsql Start[c]UP 2.0 B
CF memsql Start[c]UP 2.0 B B. Distributed Join time limit per test 1 second memory limit per test 25 ...
- CF #376 (Div. 2) C. dfs
1.CF #376 (Div. 2) C. Socks dfs 2.题意:给袜子上色,使n天左右脚袜子都同样颜色. 3.总结:一开始用链表存图,一直TLE test 6 (1)如果需 ...
- CF #375 (Div. 2) D. bfs
1.CF #375 (Div. 2) D. Lakes in Berland 2.总结:麻烦的bfs,但其实很水.. 3.题意:n*m的陆地与水泽,水泽在边界表示连通海洋.最后要剩k个湖,总要填掉多 ...
随机推荐
- 「React Native笔记」在React的 setState 中操作数组和对象的多种方法(合集)
运用在React 中 setState的对象.数组的操作时是不能用类似array.push()等方法,因为push没有返回值,setState后会出现state变成Number,为了方便他人和自己查看 ...
- P1092 最好吃的月饼
1092 最好吃的月饼 (20分) 月饼是久负盛名的中国传统糕点之一,自唐朝以来,已经发展出几百品种. 若想评比出一种“最好吃”的月饼,那势必在吃货界引发一场腥风血雨…… 在这里我们用数字说话,给 ...
- Python入门必学知识,30万年薪Python工程师带你学
Python是一种计算机编程语言.计算机编程语言和我们日常使用的自然语言有所不同,最大的区别就是,自然语言在不同的语境下有不同的理解,而计算机要根据编程语言执行任务,就必须保证编程语言写出的程序决不能 ...
- matlab练习程序(快速搜索随机树RRT)
RRT快速搜索随机树英文全称Rapid-exploration Random Tree,和PRM类似,也是一种路径规划算法. 和PRM类似,算法也需要随机撒点,不过不同的是,该算法不是全局随机撒点,而 ...
- PHP处理大数据量老用户头像更新的操作--解决数据量大超时的问题
/** * @title 老用户头像更新--每3秒调用一次接口,每次更新10条数据 * @example user/createHeadPicForOldUser? * @method GET * @ ...
- C#知识点回顾随笔目录导航
此随笔只是春节期间回顾知识点,阅读<<C#学习笔记>>记录(2019-2-4至2019...); 使用有道云笔记记录可能会有些排版问题 思维导图预览(使用的有道云,无法截取完整 ...
- ubuntu18.04下安装oh-my-zsh
安装 sudo apt-get install zsh wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/ra ...
- 前端学习(22)~css问题讲解
你是如何理解 HTML 语义化的? 语义化:指对文本内容的结构化(内容语义化),选择合乎语义的标签(代码语义化). 举例:段落用 p,边栏用 aside,主要内容用 main 标签. 好处: 便于开发 ...
- 如何用hugo搭建个人博客
如何用hugo搭建个人博客 1. 安装 Hugo 点击跳转 Hugo Releases win10 步骤: 下载解压 , 然后添加环境变量 测试: #命令行测试 hugo version 2. 创建站 ...
- Good Bye 2019
A.Card Game 题目大意:两个人都有共有n张卡牌,每张卡牌上都有一个数xi,没有两张牌上的数相同,且xi不小于1不大于n.每次两个人选出一张牌来,牌上数字大的人赢得此局,如果谁最后手上拥有所有 ...