A. Cows and Primitive Roots

  • 暴力。

B. Cows and Poker Game

  • 模拟。

C. Cows and Sequence

  • 线段树维护。

D. Cow Program

  • 除1的位置\(a_x\)都是固定的,也就说当前位置\(x\)最终的位置也是确定的。
  • 只要判断最后\(x\)超出范围,或者在环中,或者走回1这三种情况。
  • 当前信息需要记录位置\(x\)以及方向\(d\),判断状态是否在环中可以使用时间戳,若在环中,显然时间戳应该是一样的。

E. Coin Troubles

  • 题目保证\(b_i\)不相同,\(c_i\)不相同,即每个点最多出度为1,入度为1,所以要么点构成链要么构成环。
  • 环的判断只要\(O(n^3)\)DP即可,好写。或者跑一遍也可以。
  • 假设有一条链为\(i \gt j \gt k\),当k的个数加1时,\(、、、i、j\)也需要同时加1。因为题目要求\(b_i\)严格大于\(c_i\),所以在之前需要统计每个点的最少个数(就是深度)。
  • 只要构造\(、、、、、、k+j+i、j +i、i\)这些物品,问题转化成背包问

D. Cows and Cool Sequences

  • 根据题意, \((x, y)\)表示\(x=\frac{(2a+1+y)y}{2}\),转换成\[\frac{2x}{y} =2a+1+y\]
  • 显然需要满足\(y|x\), 然后等式两边式子的奇偶性。
  • 若\(y\)是奇数,则右边为偶数,左边也是偶数。
  • 若\(y\)是偶数,则右边为奇数,若左边也要为奇数,则\(y\)的2的因子数要等于\(x\)的2的因子数+1。
  • 记\(f(x)\)表示数\(x\)的最大奇数因子,\(v(x)\)表示2的因子数,则\(x=f(x)v(x)\)。
  • 根据上面的分析,\((x,y)\)是合法的,当\(f(y)|f(x)\)且\(v(y)=0\)或者\(v(y)=v(x)+1\)。
  • 对于序列上的两个位置\(i,j(i< j)\),可以在同一序列的情况下,\(f(a_j)|f(a_i)\)且\(v(a_j)=v(a_i)+j-i\ ||\ v(a_j)<j-i\)
  • 剩下的就类似于最长上升子序列的做法,找出可以在同一序列的最长长度即可。

E. Cow Tennis Tournament

  • 假设tuple为\((x, y, z)\),且\(x<y<z\)。
  • 显然不可能直接计算两两之间的大小关系,所以考虑用总方案数 - 不合法的方案数。
  • 不合法的方案数只要考虑每个值是作\(x,y,z\)中的哪一个。
  • 对于覆盖的区间,只要离线排序,插入线段树即可。

Codeforces Round #174 (Div. 1 + Div. 2)的更多相关文章

  1. Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - C. Magic Ship Time Limit: 2000 mSec P ...

  2. Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems(动态规划+矩阵快速幂)

    Problem   Educational Codeforces Round 60 (Rated for Div. 2) - D. Magic Gems Time Limit: 3000 mSec P ...

  3. Educational Codeforces Round 43 (Rated for Div. 2)

    Educational Codeforces Round 43 (Rated for Div. 2) https://codeforces.com/contest/976 A #include< ...

  4. Educational Codeforces Round 35 (Rated for Div. 2)

    Educational Codeforces Round 35 (Rated for Div. 2) https://codeforces.com/contest/911 A 模拟 #include& ...

  5. Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings

    Codeforces Educational Codeforces Round 44 (Rated for Div. 2) F. Isomorphic Strings 题目连接: http://cod ...

  6. Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes

    Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes 题目连接: http://code ...

  7. Educational Codeforces Round 63 (Rated for Div. 2) 题解

    Educational Codeforces Round 63 (Rated for Div. 2)题解 题目链接 A. Reverse a Substring 给出一个字符串,现在可以对这个字符串进 ...

  8. Educational Codeforces Round 39 (Rated for Div. 2) G

    Educational Codeforces Round 39 (Rated for Div. 2) G 题意: 给一个序列\(a_i(1 <= a_i <= 10^{9}),2 < ...

  9. Educational Codeforces Round 48 (Rated for Div. 2) CD题解

    Educational Codeforces Round 48 (Rated for Div. 2) C. Vasya And The Mushrooms 题目链接:https://codeforce ...

  10. Educational Codeforces Round 60 (Rated for Div. 2) 题解

    Educational Codeforces Round 60 (Rated for Div. 2) 题目链接:https://codeforces.com/contest/1117 A. Best ...

随机推荐

  1. Windows系统MySQL8.0的安装教程

    MySQL推出的8.0版本亮点多多,尤其是两倍的提速更让我们迫不及待地安装一睹为快.然而目前我们所用的版本还在5.7之前,今天小编给家分享一下MySQL8.0的安装,尤其是多版本MySQL的共存. 方 ...

  2. 使用Centos7 安装docker的步骤

    1.Linuxyum源切换阿里云软件源 备份本机软件源 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.b ...

  3. unity如何查找某个脚本挂在了哪些物体上

    在开发中往往会遇到一个问题:不知道整个场景中究竟有哪些物体挂载了某一个脚本.如果挨个查找太麻烦了,下面有一种方法可以快速找到解决这个问题. 在unity的Window里有一项Editor tests ...

  4. Codeforces Round #410 (Div. 2) A. Mike and palindrome【判断能否只修改一个字符使其变成回文串】

    A. Mike and palindrome time limit per test 2 seconds memory limit per test 256 megabytes input stand ...

  5. 带三角形下标的提示框(按钮button)

    HTML:<div class="leaflet-popup-content-wrapper"> <div class="leaflet-popup-c ...

  6. 【JZOJ4809】【NOIP2016提高A组五校联考1】挖金矿

    题目描述 输入 输出 样例输入 4 3 4 3 3 5 1 6 2 6 1 3 2 9 样例输出 4.4286 数据范围 样例解释 解法 二分答案. 对于答案ans,如果每一列的最大贡献之和大于0,则 ...

  7. node 写的简单爬虫(三)

    异步爬取数据 先引入 var async = require('async'); 然后同样上代码 var topicUrls = [];//存所有地址 http.get(url,function(re ...

  8. Libevent:1前言

    一:libevent概述: libevent是一个用来编写快速.可移植.非阻塞IO程序的库,它的设计目标是:可移植性.高效.可扩展性.便捷. libevent包含下列组件: evutil:对不同平台下 ...

  9. 干货|Spring Cloud Bus 消息总线介绍

    继上一篇 干货|Spring Cloud Stream 体系及原理介绍 之后,本期我们来了解下 Spring Cloud 体系中的另外一个组件 Spring Cloud Bus (建议先熟悉 Spri ...

  10. 实用的cmd命令

    1.打开iis服务器:inetmgr 2.远程连接:mstsc 3.注册表:regedit.exe