Codeforces Round #519 by Botan Investments

  1. #include<bits/stdc++.h>
  2. #include<iostream>
  3. #include<cstdio>
  4. #include<cstdlib>
  5. #include<cstring>
  6. #include<cmath>
  7. #include<algorithm>
  8. #include<queue>
  9. #include<vector>
  10. #include<map>
  11. #define lson i<<1
  12. #define rson i<<1|1
  13. #define LS l,mid,lson
  14. #define RS mid+1,r,rson
  15. #define mem(a,x) memset(a,x,sizeof(a))
  16. #define gcd(a,b) __gcd(a,b)
  17. #define ll long long
  18. #define ull unsigned long long
  19. #define lowbit(x) (x&-x)
  20. #define pb(x) push_back(x)
  21. #define enld endl
  22. #define mian main
  23. #define itn int
  24. #define prinft printf
  25. #define Max(a,b,c) max(a,max(b,c))
  26. #pragma GCC optimize(2)
  27. //#pragma comment(linker, "/STACK:102400000,102400000")
  28.  
  29. const double PI = acos (-1.0);
  30. const ll INF = 0x3f3f3f3f3f3f3f3f;
  31. ;
  32. ;
  33. ;
  34. ;
  35. ;
  36.  
  37. using namespace std;
  38.  
  39. ;
  40. int temp;
  41. ;
  42. int main() {
  43. //std::ios::sync_with_stdio(false);
  44. //cin.tie(NULL);
  45. ;
  46. while(cin>>n) {
  47. sum=;
  48. ;i<=n;++i) {
  49. cin>>temp;
  50. sum+=temp;
  51. maxn=max(temp,maxn);
  52. }
  53. for(int k=maxn;;++k) {
  54. if(k*n-sum>sum) {
  55. cout<<k<<endl;
  56. break;
  57. }
  58. }
  59. }
  60. }

A - Elections

  1. #include<bits/stdc++.h>
  2. #include<iostream>
  3. #include<cstdio>
  4. #include<cstdlib>
  5. #include<cstring>
  6. #include<cmath>
  7. #include<algorithm>
  8. #include<queue>
  9. #include<vector>
  10. #include<map>
  11. #define lson i<<1
  12. #define rson i<<1|1
  13. #define LS l,mid,lson
  14. #define RS mid+1,r,rson
  15. #define mem(a,x) memset(a,x,sizeof(a))
  16. #define gcd(a,b) __gcd(a,b)
  17. #define ll long long
  18. #define ull unsigned long long
  19. #define lowbit(x) (x&-x)
  20. #define pb(x) push_back(x)
  21. #define enld endl
  22. #define mian main
  23. #define itn int
  24. #define prinft printf
  25. #define Max(a,b,c) max(a,max(b,c))
  26. #pragma GCC optimize(2)
  27. //#pragma comment(linker, "/STACK:102400000,102400000")
  28.  
  29. const double PI = acos (-1.0);
  30. const int INF = 0x3f3f3f3f;
  31. ;
  32. ;
  33. ;
  34. ;
  35. ;
  36.  
  37. using namespace std;
  38.  
  39. int n;
  40. int a[MAXN];
  41. int ans[MAXN];
  42.  
  43. bool check(int x)
  44. {
  45. ;i+x<n;++i) {
  46. ]-a[i]!=a[i+x+]-a[i+x]) return false;
  47. }
  48. return true;
  49. }
  50.  
  51. int main() {
  52. //std::ios::sync_with_stdio(false);
  53. //cin.tie(NULL);
  54. cin>>n;
  55. ;i<=n;++i) cin>>a[i];
  56. ;
  57. a[]=;
  58. ;i<=n;++i) {
  59. if(check(i)) ans[cnt++]=i;
  60. }
  61. cout<<cnt<<endl;
  62. ;i<cnt;++i ) {
  63. if(i) cout<<' ';
  64. cout<<ans[i];
  65. }cout<<endl;
  66. }

B - Lost Array

  1. //#include<bits/stdc++.h>
  2. #include<iostream>
  3. #include<cstdio>
  4. #include<cstdlib>
  5. #include<cstring>
  6. #include<cmath>
  7. #include<algorithm>
  8. #include<queue>
  9. #include<vector>
  10. #include<map>
  11. #define lson i<<1
  12. #define rson i<<1|1
  13. #define LS l,mid,lson
  14. #define RS mid+1,r,rson
  15. #define mem(a,x) memset(a,x,sizeof(a))
  16. #define gcd(a,b) __gcd(a,b)
  17. #define ll long long
  18. #define ull unsigned long long
  19. #define lowbit(x) (x&-x)
  20. #define pb(x) push_back(x)
  21. #define enld endl
  22. #define mian main
  23. #define itn int
  24. #define prinft printf
  25. #define Max(a,b,c) max(a,max(b,c))
  26. #pragma GCC optimize(2)
  27. //#pragma comment(linker, "/STACK:102400000,102400000")
  28.  
  29. const double PI = acos (-1.0);
  30. const ll INF = 0x3f3f3f3f3f3f3f3f;
  31. ;
  32. ;
  33. ;
  34. ;
  35. ;
  36.  
  37. using namespace std;
  38.  
  39. string s;
  40. int a[MAXN];
  41.  
  42. int main() {
  43. std::ios::sync_with_stdio(false);
  44. cin.tie(NULL);
  45.  
  46. cin>>s;
  47.  
  48. ) {cout<<<<endl; ;}
  49.  
  50. mem(a,);
  51. ;i<s.size()-;++i) {
  52. if(i)cout<<' ';
  53. ]) cout<<;
  54. ;
  55. }
  56. ]=="<<endl;
  57. "<<endl;
  58. }

C - Smallest Word

  1. #include<bits/stdc++.h>
  2. #include<iostream>
  3. #include<cstdio>
  4. #include<cstdlib>
  5. #include<cstring>
  6. #include<cmath>
  7. #include<algorithm>
  8. #include<queue>
  9. #include<vector>
  10. #include<map>
  11. #define lson i<<1
  12. #define rson i<<1|1
  13. #define LS l,mid,lson
  14. #define RS mid+1,r,rson
  15. #define mem(a,x) memset(a,x,sizeof(a))
  16. #define gcd(a,b) __gcd(a,b)
  17. #define ll long long
  18. #define ull unsigned long long
  19. #define lowbit(x) (x&-x)
  20. #define pb(x) push_back(x)
  21. #define enld endl
  22. #define mian main
  23. #define itn int
  24. #define prinft printf
  25. #define Max(a,b,c) max(a,max(b,c))
  26. #pragma GCC optimize(2)
  27. //#pragma comment(linker, "/STACK:102400000,102400000")
  28.  
  29. const double PI = acos (-1.0);
  30. const ll INF = 0x3f3f3f3f3f3f3f3f;
  31. ;
  32. ;
  33. ;
  34. ;
  35. ;
  36.  
  37. using namespace std;
  38.  
  39. int n,m;
  40. ][MAXN];
  41. ][MAXN];
  42. ll ans[MAXN];
  43. ll q;
  44.  
  45. int main() {
  46. std::ios::sync_with_stdio(false);
  47. cin.tie(NULL);
  48.  
  49. cin>>n>>m;
  50. mem(ans,);
  51. ; i<=m; ++i) {
  52. ; j<=n; ++j) {
  53. cin>>a[i][j];
  54. ==)
  55. pre[i][a[i][j]]=;
  56. else
  57. pre[i][a[i][j]]=a[i][j-];
  58.  
  59. }
  60. }
  61. q=n;
  62. ; i<=n; ++i) {
  63. ll cnt=;
  64. ; j<m; ++j) {
  65. if(pre[j][a[m][i]]==pre[m][a[m][i]])
  66. cerr<<++cnt<<endl;
  67. //++cnt;
  68. }
  69. )
  70. ans[i]=ans[i-]+;
  71. q+=ans[i];
  72. }
  73. cout<<q<<endl;
  74.  
  75. }

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. 【转】Source Insight中文注释为乱码的解决办法

    我网上查了一堆解决办法,但是都是2017年以前的,并且都是针对于source insight 3.5及以下版本的解决方案,软件版本都到4.0了,应该有新方法出现. 干货:Source Insight ...

  2. Python poll IO多路复用

    一.poll介绍 poll本质上和select没有区别,只是没有了最大连接数(linux上默认1024个)的限制,原因是它基于链表存储的. 本人的另一篇博客讲了 python  select : ht ...

  3. 返回表达式列表中最小值least(exp1,exp2,exp3,……,expn)

    least(exp1,exp2,exp3,--,expn) [功能]返回表达式列表中值最小的一个.如果表达式类型不同,会隐含转换为第一个表达式类型. [参数]exp1--n,各类型表达式 [返回]ex ...

  4. 使用git pull提示refusing to merge unrelated histories

    创建了一个origin,两个人分别clone 分别做完全不同的提交 第一个人git push成功 第二个人在执行git pull的时候,提示 fatal: refusing to merge unre ...

  5. Java集合(Collection)综述

    1.集合简介 数学定义:一般地,我们把研究对象统称为元素.把一些元素组成的总体叫做集合. java集合定义:集合就是一个放数据的容器,准确的说是放数据对象引用的容器. java中通用集合类存放于jav ...

  6. html 页内跳转

    第一种 <a href="#div1">to div1</a> //跳转链接<div id="div1">div1</ ...

  7. FXML Stuffs (include and define)

    FXML Stuffs (include and define)Hello folks,Today I would like to blog about the FXML define and inc ...

  8. poj 1511 正向 反向 构两个图

    有向图 源点为1 求源点到其他各点的最短距离之和 再在其他点到源点的最短距离之和 再加起来 多源点一终点 只要反向构图就行了 Sample Input 2 //T2 2 //结点数 边数1 2 13 ...

  9. JDK和CGLIB生成动态代理类的区别

     关于动态代理和静态代理 当一个对象(客户端)不能或者不想直接引用另一个对象(目标对象),这时可以应用代理模式在这两者之间构建一个桥梁--代理对象. 按照代理对象的创建时期不同,可以分为两种: 静态代 ...

  10. mysql undo 和redo 被误删除的恢复操作(一致性)

    今天在群里看到有人说不熟悉innodb把ibdata(数据文件)和ib_logfile(事务日志)文件误删除了.不知道怎么解决.当时我也不知道怎么办.后来查阅相关资料.终找到解决方法.其实恢复也挺简单 ...