题目来自神犇chad

上次爆零是说着玩,这次真的爆零了QAQ

好吧貌似是TYVJ的模拟赛打多了..一直按照TYVJ的格式提交的压缩包..

然后莫名其妙就AK了hhh

来的时候迟到了半小时,昨晚痛苦的补作业补到了1点..,晚上补作业留下的泪就是白天浪时脑子里进的水

所以刚来的时候脑子有点昏,所以T1又是喜闻乐见的不会..

然后按照以往的套路滚去看T2

慢着...这道题好像有些眼熟?这不是我之前放在OJ上的一道题嘛 skip!

去看了看T3,Tarjan+分层图。可以,这很图论,水了一发模板

 //chad round T3
 //by Cydiater
 //2016.9.16
 #include <iostream>
 #include <cstdio>
 #include <cstring>
 #include <string>
 #include <algorithm>
 #include <queue>
 #include <map>
 #include <ctime>
 #include <cmath>
 #include <iostream>
 #include <cstdlib>
 using namespace std;
 #define ll long long
 #define up(i,j,n)        for(int i=j;i<=n;i++)
 #define down(i,j,n)        for(int i=j;i>=n;i--)
 typedef pair<int,int> pii;
 #define FILE "trip"
 ;
 const int oo=0x3f3f3f3f;
 inline int read(){
     ,f=;
     ;ch=getchar();}
     +ch-';ch=getchar();}
     return x*f;
 }
 ,LEN=,Link[MAXN],group[MAXN],group_num=,dfn[MAXN],low[MAXN],dfs_clock=,stack[MAXN],top=,Node[MAXN][],cnt=,dis[MAXN],ans=;
 priority_queue<pii, vector<pii>, greater<pii> >q;
 bool vis[MAXN];
 struct edge{
     int x,y,next,v;
 }e[MAXN],E[MAXN<<];
 namespace solution{
     inline void insert(int x,int y,int v){e[++len].next=LINK[x];LINK[x]=len;e[len].y=y;e[len].v=v;e[len].x=x;}
     inline void Insert(int x,int y,int v){E[++LEN].next=Link[x];Link[x]=LEN;E[LEN].y=y;E[LEN].v=v;E[LEN].x=x;}
     void init(){
         N=read();M=read();K=read();
         up(i,,M){
             int x=read(),y=read(),v=read();
             insert(x,y,v);
         }
     }
     void tarjan(int node){
         vis[node]=;dfn[node]=low[node]=++dfs_clock;
         stack[++top]=node;
         for(int i=LINK[node];i;i=e[i].next)
             if(!dfn[e[i].y]){
                 tarjan(e[i].y);
                 low[node]=min(low[node],low[e[i].y]);
             }else if(vis[e[i].y])    low[node]=min(low[node],dfn[e[i].y]);
         if(dfn[node]==low[node]){
             group_num++;
             int tmp;
             do{
                 tmp=stack[top--];
                 vis[tmp]=;
                 group[tmp]=group_num;
             }while(tmp!=node);
         }
     }
     void dijkstra(){
         memset(dis,,sizeof(dis));
         memset(vis,,sizeof(vis));
         dis[Node[group[]][]]=;q.push(make_pair(dis[Node[group[]][]],Node[group[]][]));
         while(!q.empty()){
             pii tmp=q.top();q.pop();
             int dist=tmp.first,node=tmp.second;
             if(vis[node])continue;
             vis[node]=;
             for(int i=Link[node];i;i=E[i].next)
                 if(dis[E[i].y]>dis[node]+E[i].v){
                     dis[E[i].y]=dis[node]+E[i].v;
                     q.push(make_pair(dis[E[i].y],E[i].y));
                 }
         }
     }
     void slove(){
         memset(vis,,sizeof(vis));
         memset(dfn,,sizeof(dfn));
         memset(low,,sizeof(low));
         up(i,,N)if(!dfn[i])tarjan(i);
         up(i,,N)up(k,,K)Node[i][k]=++cnt;
         up(i,,len){
             int x=e[i].x,y=e[i].y,v=e[i].v;
             if(group[x]==group[y])continue;
             up(k,,K)        Insert(Node[group[x]][k],Node[group[y]][k],v);
             up(k,,K-)        Insert(Node[group[x]][k],Node[group[y]][k+],);
         }
         dijkstra();
     }
     void output(){
         up(k,,K)ans=min(ans,dis[Node[group[N]][k]]);
         )ans=-;
         cout<<ans<<endl;
     }
 }
 int main(){
     //freopen("input.in","r",stdin);
     freopen(FILE".in","r",stdin);
     freopen(FILE".out","w",stdout);
     using namespace solution;
     init();
     slove();
     output();
     ;
 }

这些模板敲过好几遍了,不拍了。去看T1!

$ans \leq 50$

好呀,搞个二维前缀和枚举

 //chad round T1
 //by Cydiater
 //2016.9.16
 #include <iostream>
 #include <cstdio>
 #include <cstdlib>
 #include <cstring>
 #include <string>
 #include <algorithm>
 #include <queue>
 #include <map>
 #include <iomanip>
 #include <ctime>
 #include <cmath>
 using namespace std;
 #define ll long long
 #define up(i,j,n)        for(int i=j;i<=n;i++)
 #define down(i,j,n)        for(int i=j;i>=n;i--)
 #define FILE "papercut"
 ;
 const int oo=0x3f3f3f3f;
 inline int read(){
     ,f=;
     ;ch=getchar();}
     +ch-';ch=getchar();}
     return x*f;
 }
 int N,M,K,cnt[MAXN][MAXN];
 namespace solution{
     void init(){
         N=read();M=read();K=read();
         memset(cnt,,sizeof(cnt));
         up(i,,K){
             int x=read(),y=read();
             cnt[x][y]=;
         }
         up(i,,N)up(j,,M)cnt[i][j]=cnt[i-][j]+cnt[i][j-]-cnt[i-][j-]+cnt[i][j];
     }
     void slove(){
         down(ans,min(min(N,M),),){
             up(i,ans,N)up(j,ans,M){
                 int tmp1=cnt[i][j],tmp2=cnt[i][j-ans]+cnt[i-ans][j]-cnt[i-ans][j-ans];
                 ){
                     printf("%d\n",ans);
                     return;
                 }
             }
         }
         puts(");
     }
 }
 int main(){
     //freopen("input.in","r",stdin);
     freopen(FILE".in","r",stdin);
     freopen(FILE".out","w",stdout);
     using namespace solution;
     init();
     slove();
     ;
 }

然后水了水T2的模板

 //chad round T2
 //by Cydiater
 //2016.9.16
 #include <iostream>
 #include <cstdio>
 #include <cstring>
 #include <string>
 #include <algorithm>
 #include <queue>
 #include <map>
 #include <iomanip>
 #include <cstdlib>
 #include <ctime>
 #include <cmath>
 using namespace std;
 #define ll long long
 #define up(i,j,n)        for(int i=j;i<=n;i++)
 #define down(i,j,n)        for(int i=j;i>=n;i--)
 #define FILE "string"
 ;
 const int oo=0x3f3f3f3f;
 inline int read(){
     ,f=;
     ;ch=getchar();}
     +ch-';ch=getchar();}
     return x*f;
 }
 char s[MAXN];
 ,ans=;
 namespace solution{
     inline bool equ(int x,int y,int l){return rank[x]==rank[y]&&rank[x+l]==rank[y+l];}
     void init(){
         scanf();
         N=strlen(s+);
     }
     void suffix_sort(){
         up(i,,N){rank[i]=s[i];sa[i]=i;}
         ,i,sig=,pos=;pos<N;sig=pos){
             ,i=N-l+;i<=N;i++)p[++pos]=i;
             ;i<=N;i++)if(sa[i]>l)p[++pos]=sa[i]-l;
             ;i<=sig;i++)cnt[i]=;
             ;i<=N;i++)cnt[rank[i]]++;
             ;i<=sig;i++)cnt[i]+=cnt[i-];
             for(i=N;i;i--)sa[cnt[rank[p[i]]]--]=p[i];
             ,i=;i<=N;i++)tmp[sa[i]]=equ(sa[i],sa[i-],l)?pos:++pos;
             ;i<=N;i++)rank[i]=tmp[i];
             l=l==?:l<<;
         }
     }
     void get_height(){
         ,j=,k;i<=N;i++){
             ])){j=;continue;}
             if(j)j--;
             while(s[i+j]==s[k+j])j++;
             height[rank[i]]=j;
         }
     }
     void slove(){
         suffix_sort();
         get_height();
         up(i,,N)ans+=N-sa[i]+-height[i];
     }
     void output(){
         cout<<ans<<endl;
     }
 }
 int main(){
     //freopen("input.in","r",stdin);
     freopen(FILE".in","r",stdin);
     freopen(FILE".out","w",stdout);
     using namespace solution;
     init();
     slove();
     output();
     ;
 }

小结

除了T2出后缀数组比较坑,其他的题都很不错。其实NOIp通用的知识点就那么几个,关键还是看考试的状态。连着这几场考试都没有数论,很有可能是一个flag..

陷入LCT的坑无法自拔感觉各种基础算法都忘光了

NOIp 0916 爆零记的更多相关文章

  1. NOIp 0910 爆零记

    这套题是神犇chty出的. 刚拿到题的时候有点懵逼,因为按照一般的套路第一题都是一眼题,但是看到第一题后想了很多个算法和数据结构好像都不能很好的解决.然后就随手敲了个暴力去看T2. 嗯...文件名是b ...

  2. 「游记」NOIP 2021 爆零记

    推荐访问本人自建博客 \(\text{cjwen.top}\) 欧拉欧拉欧拉欧拉欧拉欧拉欧拉欧拉,第一次参加 \(NOIP\),欧拉欧拉欧拉欧拉欧拉欧拉欧拉欧拉. 第一题比较简单,用类似于筛质数的做法 ...

  3. Codeforces Round #423 (Div. 2, rated, based on VK Cup Finals)爆零记

    昨晚一个瓜皮说今晚有cf,听说是晚间场,我瞅了一眼,娃,VK Cup,上分的好机会,看着比赛时间就有点心酸了,0:35,当时一直在纠结要不要打的问题,当时想着应该不难吧,要不打一下吧,要不还是看看题先 ...

  4. HNOI2019 爆零记

    HNOI2019爆零记 day \(-inf\) ~ day \(0\) 开学一周之后才停的课,停课之后就开始每天被包菜.我三月份几乎没有更博,就是因为每天都被虐的自闭了. day \(0\) 本来是 ...

  5. PKUWC 2019&WC 2019爆零记

    PKUWC 2019&WC 2019爆零记 毕竟过了很久了,杂七杂八的东西就不写了,并且除成绩之外的内容不保证其正确性. Day1 T1:看到这道题很舒服啊,枚举top序算合法图的数量,状压D ...

  6. 雅礼集训1-9day爆零记

    雅礼集训1-9day爆零记 先膜一下虐爆我的JEFF巨佬 Day0 我也不知道我要去干嘛,就不想搞文化科 (文化太辣鸡了.jpg) 听李总说可以去看(羡慕)各路大佬谈笑风声,我就报一个名吧,没想到还真 ...

  7. CTS&&APIO2019爆零记

    如果你只好奇测试相关请跳至day 2 day 3 day 6 scoi 2019 之后 ​ 由于实力问题,省选的时候排名在三十多,显然是没有进队.不过可能是受过的打击比较多,所以还没有特别颓废,甚至连 ...

  8. [日常] NOIWC 2018爆零记

    开个坑慢慢更(逃 (然而没准会坑掉?) day 0 大概 $8:30$ 就滚去雅礼了qwq 过去的时候发现并没有人...进报到处楼门的时候还被强行拍照围观了一波OwO 然后就领了HZ所有人的提包和狗牌 ...

  9. HNOI2019爆零记

    HNOI2019真-爆零祭 我怎么这么菜QAQ day-37 从学科溜过来搞OI. 班主任一直在谈论我退役的事情,这就是NOIP挂分的后果...说我没考好就找理由,人家xxxxxxx可不是xxxxxx ...

随机推荐

  1. strlen 与 sizeof 的区别

    void ngx_time_init(void) { ngx_cached_err_log_time.len = sizeof("1970/09/28 12:00:00") - 1 ...

  2. 学习SQLite之路(三)

    20160616更新 参考: http://www.runoob.com/sqlite/sqlite-tutorial.html 1. SQLite  PRAGMA:可以用在 SQLite 环境内控制 ...

  3. 知乎UWP 预览

    又是很久都没有写博客了,为了表达歉意,奉上一个新的App,O(∩_∩)O! 因为商店的知乎太多了,然而,,所以一直打算自己动手写一个. 近段时间有些假期加上课程不是很忙,抽时间写了这个知乎.商店链接 ...

  4. SQLite安装、编译与应用

    什么是 SQLite SQLite是一款轻量级的.基于文件的嵌入式数据库,实现自包容.零配置.支持事务的SQL数据库引擎.与其他数据库管理系统不同,SQLite 的安装和运行非常简单,在大多数情况下, ...

  5. 关于HTML+CSS设置图片居中的方法

    有的时候我们会遇到这样一个问题,就是当我们按下F12进行使用firebug调试的时候,我们发现图像没有居中,页面底下有横向的滑动条出现,图片没能够居中,默认状态下只是紧靠在页面最左侧,而我们对图像缩小 ...

  6. Linux企业集群用商用硬件和免费软件构建高可用集群PDF

    Linux企业集群:用商用硬件和免费软件构建高可用集群 目录: 译者序致谢前言绪论第一部分 集群资源 第1章 启动服务 第2章 处理数据包 第3章 编译内容 第二部分 高可用性 第4章 使用rsync ...

  7. java 常用的一些关键字

    1.关键字extends 1.继承作用 优化代码,减少代码的重复使用. 2.继承使用时机 两个类之间必须要满足is a的关系 ,才能够拥有继承关系,不是任 何 情况下都允许继承 3.继承的使用注意事项 ...

  8. Java--剑指offer(8)

    36.输入两个链表,找出它们的第一个公共结点. 解题思路:这里主要是把两个链表的节点都放入两个栈中,这样就可以按照出栈的方式来比较节点,因为单链表只要是有相同的节点,那么之后的节点也都是一样的,所以如 ...

  9. this Activity.this Activity.class

    1. this 与 Activity.this this是你当前对象的引用,在你的例子中你肯定在内部类ClickEvent里面实现intent,他指向的是ClickEvent,而不是你要传入的Acti ...

  10. 线性表的链式存储C语言版

    #include <stdio.h> #include <malloc.h> #define N 10 typedef struct Node { int data; stru ...