I'm bored with life

水题

#include<bits/stdc++.h>
using namespace std;
typedef long long int LL;
const LL N=1,M=1,MOD=1; int main()
{//freopen("t.txt","r",stdin);
ios::sync_with_stdio(false);
LL a,b;
scanf("%I64d%I64d",&a,&b);
LL c=min(a,b);
LL ans=1;
for(LL i=2;i<=c;i++)
ans=ans*i;
printf("%I64d\n",ans);
return 0;
}

  

Crossword solving

水题

#include<bits/stdc++.h>
using namespace std;
typedef long long int LL;
const LL N=1,M=1,MOD=1; int main()
{//freopen("t.txt","r",stdin);
ios::sync_with_stdio(false);
int n,m;
char a[2000],b[2000];
scanf("%d%d",&n,&m);
scanf("%s%s",&b,&a);
vector<int>pos;
pos.resize(n+1);
for(int i=0;i+n-1<m;i++)
{
vector<int>pon;
for(int j=0;j<n;j++)
{
if(a[i+j]!=b[j])pon.push_back(j+1);
}
if(pon.size()<pos.size())pos=pon;
}
printf("%d\n",pos.size());
for(int i=0;i<pos.size();i++)
{
printf("%d ",pos[i]);
}
printf("\n");
return 0;
}

  

Hacker, pack your bags!

比较裸的线段树,Mdzz 一开始没用LL WA了好几发 线段树写的还不是很熟练。。 最后调出来没时间看后边的题了!!

#include<bits/stdc++.h>
using namespace std;
typedef long long int LL;
const LL N=200005,M=15000000,MOD=1;
LL L[N],R[N],C[N];
int rt1[N],rt2[N],lc[M],rc[M],sumc[M],tot;
int n,x;
void update(int cur)
{
sumc[cur]=2e9+10;
if(lc[cur]!=0)sumc[cur]=min(sumc[cur],sumc[lc[cur]]);
if(rc[cur]!=0)sumc[cur]=min(sumc[cur],sumc[rc[cur]]);
}
void insert(int cur,int val,int cost,int l,int r)
{
if(l==r&&l==val){if(sumc[cur]==0)sumc[cur]=cost;else sumc[cur]=min(sumc[cur],cost);return ;}
int mid=(l+r)/2;
if(val<=mid)
{
if(lc[cur]==0)lc[cur]=++tot;
insert(lc[cur],val,cost,l,mid);
}
else
{
if(rc[cur]==0)rc[cur]=++tot;
insert(rc[cur],val,cost,mid+1,r);
}
update(cur);
}
LL que1(int cur,int vl,int vr,int l,int r)
{
if(cur==0||r<vl||l>vr)return 2e9+10;
if(r<=vr&&l>=vl)return sumc[cur];
int mid=(l+r)/2;
LL ret=2e9+10;
if(vl<=mid)ret=min(ret, que1(lc[cur],vl,min(mid,vr),l,mid));
if(vr>mid) ret=min( ret,que1(rc[cur],max(vl,mid+1),vr,mid+1,r));
return ret;
}
int main()
{//freopen("t.txt","r",stdin);
ios::sync_with_stdio(false);
scanf("%d%d",&n,&x);
for(int i=1;i<=n;i++)
{
scanf("%I64d%I64d%I64d",&L[i],&R[i],&C[i]);
int len=R[i]-L[i]+1;
if(rt1[len]==0&&rt2[len]==0)rt1[len]=++tot,rt2[len]=++tot;
insert(rt1[len],R[i],C[i],1,N);insert(rt2[len],L[i],C[i],1,N);
}
LL ans=2e9+10;
for(int i=1;i<=n;i++)
{
int len=R[i]-L[i]+1;
if(len>=x)continue;
ans=min(ans,C[i]+min(que1(rt1[x-len],1,L[i]-1,1,N),que1(rt2[x-len],R[i]+1,N,1,N)));
}
if(ans==2e9+10)printf("-1\n");
else printf("%I64d\n",ans);
return 0;
}

  

My pretty girl Noora

Liar

Madness

codeforces round 422 div2 补题 CF 822 A-F的更多相关文章

  1. codeforces round 421 div2 补题 CF 820 A-E

    A Mister B and Book Reading  O(n)暴力即可 #include<bits/stdc++.h> using namespace std; typedef lon ...

  2. Codeforces round 419 div2 补题 CF 816 A-E

    A Karen and Morning 水题 注意进位即可 #include<bits/stdc++.h> using namespace std; typedef long long i ...

  3. codeforces round 418 div2 补题 CF 814 A-E

    A An abandoned sentiment from past 水题 #include<bits/stdc++.h> using namespace std; int a[300], ...

  4. codeforces round 417 div2 补题 CF 812 A-E

    A Sagheer and Crossroads 水题略过(然而被Hack了 以后要更加谨慎) #include<bits/stdc++.h> using namespace std; i ...

  5. codeforces round 416 div2 补题 CF 811 A B C D E

    A. Vladik and Courtesy 水题略过 #include<cstdio> #include<cstdlib> #include<cmath> usi ...

  6. codeforces round 420 div2 补题 CF 821 A-E

    A Okabe and Future Gadget Laboratory 暴力 #include<bits/stdc++.h> using namespace std; typedef l ...

  7. Educational Codeforces Round 23 A-F 补题

    A Treasure Hunt 注意负数和0的特殊处理.. 水题.. 然而又被Hack了 吗的智障 #include<bits/stdc++.h> using namespace std; ...

  8. codeforces 447 A-E div2 补题

    A DZY Loves Hash 水题 #include<iostream> #include<cstdio> #include<cstdlib> #include ...

  9. 【前行】◇第3站◇ Codeforces Round #512 Div2

    [第3站]Codeforces Round #512 Div2 第三题莫名卡半天……一堆细节没处理,改一个发现还有一个……然后就炸了,罚了一啪啦时间 Rating又掉了……但是没什么,比上一次好多了: ...

随机推荐

  1. Ubuntu 16.04安装Jetty Web服务器

    一.下载 http://www.eclipse.org/jetty/download.html 二.安装 tar -zxvf jetty-distribution-9.4.7.v20170914.ta ...

  2. UNIDAC不能识别CLIENTDATASET的TSINGLEFIELD

    UNIDAC不能识别CLIENTDATASET的TSINGLEFIELD FIREDAC,UNIDAC这些通用的数据引擎,对某种数据库的支持,细节方面总有BUG. UNIDAC6.2.8发现不能识别C ...

  3. Linux 开发板网络设置

    改动IP地址步骤: ①改动/etc/eth0-setting 命令:vi /etc/eth0-setting ②改动对应的信息.最后:wq退出 ③重新启动eth0 命令:/etc/init.d/ifc ...

  4. 进程间通信之-信号signal--linux内核剖析(九)

    信号及信号来源 什么是信号 信号是UNIX和Linux系统响应某些条件而产生的一个事件.接收到该信号的进程会对应地採取一些行动.通常信号是由一个错误产生的. 但它们还能够作为进程间通信或修改行为的一种 ...

  5. 数组遍历 map()、forEach() 及 字符串切割 split() / 字符串截取 slice()、substring()、substr()

    JS数组遍历的几种方式 JS数组遍历,基本就是for,forin,foreach,forof,map等等一些方法,以下介绍几种本文分析用到的数组遍历方式以及进行性能分析对比 第一种:普通for循环 代 ...

  6. VLFeat中SIFT特征点检测

    本代码使用VLFeat库中的函数对一幅图像进行了SIFT检测 需要事先配置好VLFeat和OpenCV,VLFeat的配置参考前一篇博文,OpenCV的配置网上一大堆,自己去百度 #include & ...

  7. 疯狂Java学习笔记(77)-----------凝视注意事项

    代码凝视,能够说是比代码本身更重要.这里有一些方法能够确保你写在代码中的凝视是友好的: 不要反复阅读者已经知道的内容 能明白说明代码是做什么的凝视对我们是没有帮助的. // If the color ...

  8. ViewPagerTransforms

    https://github.com/eltld/ViewPagerTransforms

  9. String 字符串基本使用

    目录 一.JavaDoc解释 二.基础属性和构造函数 三.基本方法说明 一.JavaDoc解释 String类表示字符串,所有Java程序中的字符串像是"abc"都是此类的实例,字 ...

  10. HDOJ_ How can I read input data until the end of file ?

    Language C C++ Pascal To read numbers int n;while(scanf("%d", &n) != EOF){ ...} int n; ...