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个湖,总要填掉多 ...
随机推荐
- texlive 安装
texlive 可以从下面两个网址下载 https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/Images/ https://mirror ...
- Jquery选择器大全汇总
一.选择器 1.三个基本选择器,$("#ID") .$(".className") .$("tagName") 2.其他选择器 //htm ...
- js 对象补充
js 对象 普通对象与对象简写 js 没有字典类型,只有对象类型,对象可以完全替代字典来使用 js 中对象的属性名,都采用字符串类型,所以就可以省略字符串的引号标识 对象中属性值为函数时,称之为方法, ...
- 热门提示输入之AutoCompleteTextView
前言: 在我们百度时,经常会遇到在你输入一个内容后在你的输入框的下面会提示一些别的热门的东西,接下来我们来简单实现这种功能 正文: 直接上代码,和之前的东西都大同小异 下面是Java代码 public ...
- Spring Boot 核心注解与配置文件
@SpringBootApplication注解 Spring Boot项目有一个入口类 (*Application) 在这个类中有一个main 方法,是运行该项目的切入点.而@SpringBootA ...
- 51nod 1416:两点 深搜
1416 两点 题目来源: CodeForces 基准时间限制:1 秒 空间限制:131072 KB 分值: 20 难度:3级算法题 收藏 关注 福克斯在玩一款手机解迷游戏,这个游戏叫做" ...
- Spring的AOP开发(基于ApsectJ的注解)
创建项目,导包 编写目标类并配置 创建OrderDao package com.rick.aop.demo1; public class OrderDao { public void save() { ...
- 7.11 如何应用Varnish
动态数据缓存 Step 1 修改devault.vcl文件 # This ) # man page for details on VCL syntax and semantics. # # Defau ...
- Sqlserver自动备份bat
1.bat文件 @echo off echo 删除30天前的备分文件和日志 forfiles /p /c "cmd /c del @path" \Tools\Binn echo 数 ...
- python反序列化漏洞
原理在网页源码中如果出现将用户输入数据进行反序列化当成参数输出时,出现漏洞,可造成任意命令执行例如网页源码try: become = self.get_argument('become') ...