Codeforces Round #116 (Div. 2, ACM-ICPC Rules)

代码


A. Defragmentation

  • 按颜色分配\(1\)到\(\sum_{i=1}^{m}{n_i}\)位置,那么可以得到\(t_i\)表示位置\(i\)最后占据位置\(t_i\),-1表示该位置为空。
  • 那么会出现两种情况:
  1. \(t_1 \to t_2 \to \cdots \to \ {-1}\),即一条链,从后面往前覆盖。
  2. \(t_1 \to t_2 \to \cdots \to t_i \to t_1\),构成一条链,那么找到一个空位置,将其中一个值暂存在空位置上,变成一条链,最后再把暂存的值放到相应的位置上。

B. Divisibility Rules

  • \(2-type\):\[gcd(d, b, b^2, \cdots, b^k) = 1\]
  • \(3-type\):\[(b-1)\ mod\ d =0\]
  • \(11-type\):\[(b+1)\ mod\ d =0\]
  • \(6-type\):分解质因数,判断每种是否都能表示成前3种之一。

C. Letter

  • 枚举边界,统计前半部分大写字母个数,后半部分小写字母个数。

D. Name

  • 尽可能让前缀相等。
  • \(t\)是\(s\)的前缀情况特判。

E. Cubes

  • 统计每种颜色的位置。
  • 每种颜色单独做,维护左右边界,当操作次数超过k时缩小范围。

F. Mathematical Analysis Rocks!

  • \[p[a[i]] = b[i]\]

Codeforces Round #116 (Div. 2, ACM-ICPC Rules)的更多相关文章

  1. codeforces水题100道 第十八题 Codeforces Round #289 (Div. 2, ACM ICPC Rules) A. Maximum in Table (brute force)

    题目链接:http://www.codeforces.com/problemset/problem/509/A题意:f[i][1]=f[1][i]=1,f[i][j]=f[i-1][j]+f[i][j ...

  2. Codeforces Round #289 (Div. 2, ACM ICPC Rules) E. Pretty Song 算贡献+前缀和

    E. Pretty Song time limit per test 1 second memory limit per test 256 megabytes input standard input ...

  3. Codeforces Round #289 (Div. 2, ACM ICPC Rules) A. Maximum in Table【递推】

    A. Maximum in Table time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  4. 贪心 Codeforces Round #289 (Div. 2, ACM ICPC Rules) B. Painting Pebbles

    题目传送门 /* 题意:有 n 个piles,第 i 个 piles有 ai 个pebbles,用 k 种颜色去填充所有存在的pebbles, 使得任意两个piles,用颜色c填充的pebbles数量 ...

  5. 递推水题 Codeforces Round #289 (Div. 2, ACM ICPC Rules) A. Maximum in Table

    题目传送门 /* 模拟递推水题 */ #include <cstdio> #include <iostream> #include <cmath> #include ...

  6. Codeforces Round #622 (Div. 2) B. Different Rules(数学)

    Codeforces Round #622 (Div. 2) B. Different Rules 题意: 你在参加一个比赛,最终按两场分赛的排名之和排名,每场分赛中不存在名次并列,给出参赛人数 n ...

  7. Codeforces Round #116 (Div. 2, ACM-ICPC Rules) E. Cubes (尺取)

    题目链接:http://codeforces.com/problemset/problem/180/E 给你n个数,每个数代表一种颜色,给你1到m的m种颜色.最多可以删k个数,问你最长连续相同颜色的序 ...

  8. Codeforces Round #116 (Div. 2, ACM-ICPC Rules) C. Letter 暴力

    C. Letter Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/180/problem/C D ...

  9. Codeforces Round #116 (Div. 2, ACM-ICPC Rules) Letter(DP 枚举)

    Letter time limit per test 1 second memory limit per test 256 megabytes input standard input output ...

随机推荐

  1. wp8.1 C#技巧: 计时器

    public MainPage() { this.InitializeComponent(); this.timer = new DispatcherTimer();//新建委托时间实例 timer. ...

  2. java---数据格式的验证

    package cc.cococ.trade.util; import java.util.regex.Matcher; import java.util.regex.Pattern; public ...

  3. dhtmlxScheduler日历日程控件包括天视图,周视图,月视图,年视图和日程表视图

    dhtmlxScheduler 是一个基于Web的类似于Outlook的日历日程控件. 它完全由javascript/js/css编写, 提供类似于MS Outlook Calendar, Apple ...

  4. 在T-SQL中访问远程数据库(openrowset、opendatasource、openquery)

    1.  启用Ad Hoc Distributed Queries 在使用openrowset/opendatasource前要先启用Ad Hoc Distributed Queries服务,因为这个服 ...

  5. 在android中使用achartengine来绘制各种图表

    可以绘制线性图,点状图,柱状图,饼状图,气泡图等 1. [文件] ABarChart.java ~ 2KB     下载(231) ? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 ...

  6. 有关WAMPSERVER 环境搭建 如何修改端口,MySQL数据库的修改

    环境搭建 http://share.weiyun.com/88896747fedd4e8b19afebea18f7684c 一.修改Apache的监听端口 1.在界面中选Apache,弹出隐藏菜单选项 ...

  7. golang vim环境搭建

    主要使用到的是golang的vim插件vim-go, 安装方法: (1)配置好自己的GOPATH和GOROOT: (2)在GOPATH目录下建立 src.pkg.main.bin四个目录: (3)安装 ...

  8. .NET的语法优化

    1.多参数 判断 条件 //判断 var fileKey = new { DateStart = search.DateStart.IsNull(), //关开始时间 DateEnd = search ...

  9. Mac环境下装node.js,npm,express

    1. 下载node.js for Mac 地址: http://nodejs.org/ 直接下载 pkg的,双击安装,一路点next,很容易就搞定了. 安装完会提醒注意 node和npm的路径是 /u ...

  10. MooFest_二维树状数组

    Description Every year, Farmer John's N (1 <= N <= 20,000) cows attend "MooFest",a s ...