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. Vue--过滤器(私有和公有)

    一.过滤器的基本使用 <!DOCTYPE html> <html lang="en"> <head> <meta charset=&quo ...

  2. Java1.8新特性 - Stream流式算法

    一. 流式处理简介   在我接触到java8流式数据处理的时候,我的第一感觉是流式处理让集合操作变得简洁了许多,通常我们需要多行代码才能完成的操作,借助于流式处理可以在一行中实现.比如我们希望对一个包 ...

  3. [leetcode] Reverse Words in a String [1]

    一.题目: Given an input string, reverse the string word by word. For example, Given s = "the sky i ...

  4. iOS 使用Quartz和OpenGL绘图

    http://blog.csdn.net/coder9999/article/details/7641701 第十二章 使用Quartz和OpenGL绘图 有时应用程序需要能够自定义绘图.一个库是Qu ...

  5. Spring4.x 基础知识点

    # Spring4.x 基础知识点## 第二章 快速入门- 一般情况下,需要在业务模块包下进一步按分层模块划分子包,如user\dao.user\service.viewspace\dao.views ...

  6. git pull 提示错误,Your local changes to the following files would be overwritten by merge

    error: Your local changes to the following files would be overwritten by merge: Please commit your c ...

  7. RapidMiner Studio 入门

    http://docs.rapidminer.com/studio/getting-started/ RapidMiner Studio 入门 FEIFEI MA 2015-12-07RAPIDMIN ...

  8. Android Bitmap缓存介绍

    转载自http://blog.csdn.net/linghu_java/article/details/8595717 Android中加载一个Bitmap(位图)到你的UI界面是非常简单的,但是如果 ...

  9. day3-转自金角大王

    本节内容 1. 函数基本语法及特性 2. 参数与局部变量 3. 返回值 嵌套函数 4.递归 5.匿名函数 6.函数式编程介绍 7.高阶函数 8.内置函数 温故知新 1. 集合 主要作用: 去重 关系测 ...

  10. shell脚本练习题(更新中...)

    练习题(这里贴的是自己写的代码, 网上给的题目代码我会附加在最下面) 1. 编写shell脚本,计算1-100的和: #!/bin/bash #caculate the to `; do sum=$[ ...