Codeforces Round #519 by Botan Investments

 #include<bits/stdc++.h>
 #include<iostream>
 #include<cstdio>
 #include<cstdlib>
 #include<cstring>
 #include<cmath>
 #include<algorithm>
 #include<queue>
 #include<vector>
 #include<map>
 #define lson i<<1
 #define rson i<<1|1
 #define LS l,mid,lson
 #define RS mid+1,r,rson
 #define mem(a,x) memset(a,x,sizeof(a))
 #define gcd(a,b) __gcd(a,b)
 #define ll long long
 #define ull unsigned long long
 #define lowbit(x) (x&-x)
 #define pb(x) push_back(x)
 #define enld endl
 #define mian main
 #define itn int
 #define prinft printf
 #define Max(a,b,c) max(a,max(b,c))
 #pragma GCC optimize(2)
 //#pragma comment(linker, "/STACK:102400000,102400000")

 const double PI = acos (-1.0);
 const ll INF = 0x3f3f3f3f3f3f3f3f;
 ;
 ;
 ;
 ;
 ;

 using namespace std;

 ;
 int temp;
 ;
 int main() {
     //std::ios::sync_with_stdio(false);
     //cin.tie(NULL);
     ;
     while(cin>>n) {
         sum=;
         ;i<=n;++i) {
             cin>>temp;
             sum+=temp;
             maxn=max(temp,maxn);
         }
         for(int k=maxn;;++k) {
             if(k*n-sum>sum) {
                 cout<<k<<endl;
                 break;
             }
         }
     }
 }

A - Elections

 #include<bits/stdc++.h>
 #include<iostream>
 #include<cstdio>
 #include<cstdlib>
 #include<cstring>
 #include<cmath>
 #include<algorithm>
 #include<queue>
 #include<vector>
 #include<map>
 #define lson i<<1
 #define rson i<<1|1
 #define LS l,mid,lson
 #define RS mid+1,r,rson
 #define mem(a,x) memset(a,x,sizeof(a))
 #define gcd(a,b) __gcd(a,b)
 #define ll long long
 #define ull unsigned long long
 #define lowbit(x) (x&-x)
 #define pb(x) push_back(x)
 #define enld endl
 #define mian main
 #define itn int
 #define prinft printf
 #define Max(a,b,c) max(a,max(b,c))
 #pragma GCC optimize(2)
 //#pragma comment(linker, "/STACK:102400000,102400000")

 const double PI = acos (-1.0);
 const int INF = 0x3f3f3f3f;
 ;
 ;
 ;
 ;
 ;

 using namespace std;

 int n;
 int a[MAXN];
 int ans[MAXN];

 bool check(int x)
 {
     ;i+x<n;++i) {
         ]-a[i]!=a[i+x+]-a[i+x]) return false;
     }
     return true;
 }

 int main() {
     //std::ios::sync_with_stdio(false);
     //cin.tie(NULL);
     cin>>n;
     ;i<=n;++i) cin>>a[i];
     ;
     a[]=;
     ;i<=n;++i) {
         if(check(i)) ans[cnt++]=i;
     }
     cout<<cnt<<endl;
     ;i<cnt;++i ) {
         if(i) cout<<' ';
         cout<<ans[i];
     }cout<<endl;
 }

B - Lost Array

 //#include<bits/stdc++.h>
 #include<iostream>
 #include<cstdio>
 #include<cstdlib>
 #include<cstring>
 #include<cmath>
 #include<algorithm>
 #include<queue>
 #include<vector>
 #include<map>
 #define lson i<<1
 #define rson i<<1|1
 #define LS l,mid,lson
 #define RS mid+1,r,rson
 #define mem(a,x) memset(a,x,sizeof(a))
 #define gcd(a,b) __gcd(a,b)
 #define ll long long
 #define ull unsigned long long
 #define lowbit(x) (x&-x)
 #define pb(x) push_back(x)
 #define enld endl
 #define mian main
 #define itn int
 #define prinft printf
 #define Max(a,b,c) max(a,max(b,c))
 #pragma GCC optimize(2)
 //#pragma comment(linker, "/STACK:102400000,102400000")

 const double PI = acos (-1.0);
 const ll INF = 0x3f3f3f3f3f3f3f3f;
 ;
 ;
 ;
 ;
 ;

 using namespace std;

 string s;
 int a[MAXN];

 int main() {
     std::ios::sync_with_stdio(false);
     cin.tie(NULL);

     cin>>s;

     ) {cout<<<<endl; ;}

     mem(a,);
     ;i<s.size()-;++i) {
         if(i)cout<<' ';
         ]) cout<<;
         ;
     }
     ]=="<<endl;
     "<<endl;
 }

C - Smallest Word

 #include<bits/stdc++.h>
 #include<iostream>
 #include<cstdio>
 #include<cstdlib>
 #include<cstring>
 #include<cmath>
 #include<algorithm>
 #include<queue>
 #include<vector>
 #include<map>
 #define lson i<<1
 #define rson i<<1|1
 #define LS l,mid,lson
 #define RS mid+1,r,rson
 #define mem(a,x) memset(a,x,sizeof(a))
 #define gcd(a,b) __gcd(a,b)
 #define ll long long
 #define ull unsigned long long
 #define lowbit(x) (x&-x)
 #define pb(x) push_back(x)
 #define enld endl
 #define mian main
 #define itn int
 #define prinft printf
 #define Max(a,b,c) max(a,max(b,c))
 #pragma GCC optimize(2)
 //#pragma comment(linker, "/STACK:102400000,102400000")

 const double PI = acos (-1.0);
 const ll INF = 0x3f3f3f3f3f3f3f3f;
 ;
 ;
 ;
 ;
 ;

 using namespace std;

 int n,m;
 ][MAXN];
 ][MAXN];
 ll ans[MAXN];
 ll q;

 int main() {
     std::ios::sync_with_stdio(false);
     cin.tie(NULL);

     cin>>n>>m;
     mem(ans,);
     ; i<=m; ++i) {
         ; j<=n; ++j) {
             cin>>a[i][j];
             ==)
                 pre[i][a[i][j]]=;
             else
                 pre[i][a[i][j]]=a[i][j-];

         }
     }
     q=n;
     ; i<=n; ++i) {
         ll cnt=;
         ; j<m; ++j) {
             if(pre[j][a[m][i]]==pre[m][a[m][i]])
                 cerr<<++cnt<<endl;
                 //++cnt;
         }
         )
             ans[i]=ans[i-]+;
         q+=ans[i];
     }
     cout<<q<<endl;

 }

D - Mysterious Crime

Codeforces Round #519 by Botan Investments的更多相关文章

  1. Codeforces Round #519 by Botan Investments(前五题题解)

    开个新号打打codeforces(以前那号玩废了),结果就遇到了这么难一套.touristD题用了map,被卡掉了(其实是对cf的评测机过分自信),G题没过, 700多行代码,码力惊人.关键是这次to ...

  2. Codeforces Round #519 by Botan Investments F. Make It One

    https://codeforces.com/contest/1043/problem/F 题意 给你n个数,求一个最小集合,这个集合里面数的最大公因数等于1 1<=n<=3e5 1< ...

  3. Codeforces Round #519 by Botan Investments翻车记

    A:枚举答案即可.注意答案最大可达201,因为这个wa了一发瞬间爆炸. #include<iostream> #include<cstdio> #include<cmat ...

  4. 【Codeforces Round #519 by Botan Investments E】Train Hard, Win Easy

    [链接] 我是链接,点我呀:) [题意] [题解] 设每个人做第一题.第二题的分数分别为x,y 我们先假设没有仇视关系. 即每两个人都能进行一次训练. 那么 对于第i个人. 考虑第j个人对它的贡献 如 ...

  5. 【Codeforces Round #519 by Botan Investments A】 Elections

    [链接] 我是链接,点我呀:) [题意] [题解] 枚举k 那么另外一个人的得票就是nk-sum(ai) 找到最小的满足nk-sum(ai)>sum(ai)的k就ok了 [代码] #includ ...

  6. 【 Codeforces Round #519 by Botan Investments B】Lost Array

    [链接] 我是链接,点我呀:) [题意] [题解] 枚举k 不难根据a得到x[0..k-1] 然后再根据a[k+1..n]来验证一下得到的x是否正确就好. [代码] #include <bits ...

  7. 【Codeforces Round #519 by Botan Investments C】 Smallest Word

    [链接] 我是链接,点我呀:) [题意] [题解] 模拟了一两下.. 然后发现. 对于每一个前缀. 组成的新的最小字典序的字符串 要么是s[i]+reverse(前i-1个字符经过操作形成的最大字典序 ...

  8. 【Codeforces Round #519 by Botan Investments D】Mysterious Crime

    [链接] 我是链接,点我呀:) [题意] 相当于问你这m个数组的任意长度公共子串的个数 [题解] 枚举第1个数组以i为起点的子串. 假设i..j是以i开头的子串能匹配的最长的长度. (这个j可以给2. ...

  9. Codeforces Round #519 题解

    A. Elections 题意概述 给出 \(a_1, \ldots, a_n\),求最小的 \(k (k \ge \max a_i)\), 使得 \(\sum_{i=1}^n a_i < \s ...

随机推荐

  1. tomcat配置文件context.xml和server.xml分析

    在tomcat 5.5之前Context体现在/conf/server.xml中的Host里的<Context>元素,它由Context接口定义.每个<Context元素代表了运行在 ...

  2. V$SQLAREA

    1.查看消耗资源最多的SQL: SELECT hash_value, executions, buffer_gets, disk_reads, parse_calls FROM V$SQLAREA W ...

  3. 转载:分布式文件系统 - FastDFS 在 CentOS 下配置安装部署(2)

    原文:http://blog.mayongfa.cn/193.html 一.安装 Nginx 和 fastdfs-nginx-module 安装 Nginx 请看:从零开始学 Java - CentO ...

  4. TCP/IP五层层次模型

    TCP/IP层次模型共分为五层:应用层HTTP.传输层TCP.网络层IP.数据链路层Data-link.物理层physical.·         应用层-应用层是所有用户所面向的应用程序的统称.IC ...

  5. Intellij IDEA14 搜索框及控制台乱码解决

    搜索ctrl+F及ctrl+H的搜索框.调试的时候控制台.导入module都显示为为中文乱码 如下: 解决方案: File->Setting->IDE Settings->Appea ...

  6. Java用四种方法实现阶乘n! (factorial)

    1. 引言 实现阶乘的方法很多,这边介绍四种方法,分别是递归,尾递归,循环和BigDecimal. 2. 代码 public class Test { public static void main( ...

  7. 生活工作必备之SMART原则

    所谓SMART原则,即: 1. 目标必须是具体的(Specific) 2. 目标必须是可以衡量的(Measurable) 3. 目标必须是可以达到的(Attainable) 4. 目标必须和主要目标具 ...

  8. java tomcat linux 环境变量设置

    一https://www.cnblogs.com/hanshuai/p/9604730.html :whereis java //查找java 安装路径:which java //查找java 执行路 ...

  9. django 2中的app_name和namespace

    最近看<精通DJANGO>里遇到的疑惑. 简书URL如下: https://www.jianshu.com/p/404500a0408a 其中的官方解释: 应用命名空间 它表示正在部署的应 ...

  10. 小米note开启调试模式

    1.刷机为开发版本. 2.拨电话界面输入   *#*#717717#*#*  开启调试模式. 3.驱动好像会自己安装.