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. 图说OSI七层网络模型

    开放式系统互联通信参考模型(英语:Open System Interconnection Reference Model,缩写为 OSI),简称为OSI模型(OSI model),一种概念模型,由国际 ...

  2. 使用icomoon把svg图片生成字体图标

    今天看了使用icomoon来将svg转换成图标字体,本来是不会使用别人给的svg,也不清楚具体的好处是什么,查了svg以后,越来越懵,svg挺好的为什么要转成图标字体呢. 一.SVG介绍 SVG 是一 ...

  3. luogu P1704 寻找最优美做题曲线

    题目背景 nodgd是一个喜欢写程序的同学,前不久(好像还是有点久了)洛谷OJ横空出世,nodgd同学当然第一时间来到洛谷OJ刷题.于是发生了一系列有趣的事情,他就打算用这些事情来出题恶心大家-- 题 ...

  4. [Bzoj3205][Apio2013]机器人(斯坦纳树)(bfs)

    3205: [Apio2013]机器人 Time Limit: 15 Sec  Memory Limit: 128 MBSubmit: 977  Solved: 230[Submit][Status] ...

  5. 【试水CAS-4.0.3】第06节_CAS服务端配置HTTPS

    完整版见https://jadyer.github.io/2012/05/30/tomcat-https/ /** * @see CAS服务端配置HTTPS * @see -------------- ...

  6. Node.js机制及原理理解初步

    http://blog.csdn.net/leftfist/article/details/41891407 一.node.js优缺点 node.js是单线程. 好处就是 1)简单 2)高性能,避免了 ...

  7. app具体介绍界面-01

    在我们的上一篇博客中,我们介绍了首页中的app列表界面怎样完毕.这个ListView以及其Adapter会在我们后面的界面中重用,所以这个是比較重要的,在这一篇博客中,我们先完毕app具体介绍界面的一 ...

  8. VB.net版机房收费系统——结账功能实现(调错与优化)

    调错部分 上一篇博客<VB.net版机房收费系统--结账功能实现(代码部分>说的是结账功能的实现,亮出了代码.是在为这篇博客做铺垫.尽管结账功能代码是借鉴的巨人的博客.可是自己比着葫芦画瓢 ...

  9. SPOJ VLATTICE Visible Lattice Points (莫比乌斯反演基础题)

    Visible Lattice Points Consider a N*N*N lattice. One corner is at (0,0,0) and the opposite one is at ...

  10. dsp端编译异常之max和min未定义

    (1)在函数之前 声明__stdcall 时 在linux 端或dsp端 linux 之前的加上宏定义 __stdcall是MS的编译器使用的只需要#define __stdcall定义一个宏就可以 ...