[CF1220C] Substring Game in the Lesson - 博弈论
[CF1220C]
Description
给定一个字符串 \(S\) , 同时维护一个区间 \([l,r]\) 。轮流操作,每次可以扩展到一个新区间使得原区间是新区间的真子区间,并且字典序更小,不能操作的人输。初态区间为 \([k,k]\) ,你需要对 \(k=1,2,...,|S|\) 判断胜负性。
Solution
很容易发现游戏最多玩一轮,所以只需要判断每个字母之前有没有更小的字母就可以了。
#include <bits/stdc++.h>
using namespace std;
string str;
int c[27];
int main()
{
ios::sync_with_stdio(false);
cin>>str;
int n=str.length();
for(int i=0;i<n;i++)
{
c[str[i]-'a'+1]++;
int flag=0;
for(int j=0;j<str[i]-'a'+1;j++) flag+=c[j];
if(flag) cout<<"Ann"<<endl;
else cout<<"Mike"<<endl;
}
}
[CF1220C] Substring Game in the Lesson - 博弈论的更多相关文章
- Codeforces Round #586 (Div. 1 + Div. 2) C. Substring Game in the Lesson
链接: https://codeforces.com/contest/1220/problem/C 题意: Mike and Ann are sitting in the classroom. The ...
- Codeforces 1220C. Substring Game in the Lesson
传送门 首先显然的,如果 $l$ 能移动,那么 $r$ 一定可以随便移动,如果 $l$ 不动,那么 $r$ 一定不能动 那么我们现在只要考虑 $l$ 的移动即可 考虑找到位置 $k$ 之前的最左边的最 ...
- Codeforces Round #586 (Div. 1 + Div. 2)
传送门 A. Cards 记录一下出现的个数就行. Code #include <bits/stdc++.h> #define MP make_pair #define fi first ...
- Codeforces Round #586
目录 Contest Info A. Cards B. Multiplication Table C. Substring Game in the Lesson D. Alex and Julian ...
- LeetCode[3] Longest Substring Without Repeating Characters
题目描述 Given a string, find the length of the longest substring without repeating characters. For exam ...
- 最长回文子串-LeetCode 5 Longest Palindromic Substring
题目描述 Given a string S, find the longest palindromic substring in S. You may assume that the maximum ...
- POJ3693 Maximum repetition substring [后缀数组 ST表]
Maximum repetition substring Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 9458 Acc ...
- [LeetCode] Longest Substring with At Least K Repeating Characters 至少有K个重复字符的最长子字符串
Find the length of the longest substring T of a given string (consists of lowercase letters only) su ...
- Lesson 18 He often does this!
Text After I had had lunch at a village pub, I looked for my bag. I had left it on a chair beside th ...
随机推荐
- java使用原生MySQL实现数据的增删改查以及数据库连接池技术
一.工具类及配置文件准备工作 1.1 引入jar包 使用原生MySQL,只需要用到MySQL连接的jar包,maven引用方式如下: <dependency> <groupId> ...
- Ansible之优化提升执行效率
今天分享一下Ansible在工作环境中有那些可以优化的配置 环境介绍:以前在公司工作处理服务器问题,需要用批量操作都是用shell脚本编写的工具,后来发现Ansible这个自动化工具,安装简单,操作起 ...
- 我国自主开发的编程语言“木兰”居然是一个披着“洋”皮的Python!
究竟是真“自主”,还是又一个披着“洋”皮的“红芯浏览器”? 作者 | 沉迷单车的追风少年 出品 | CSDN博客 昨天看到新闻: ! 心头一震,看起来很厉害啊!毕竟前几天美国宣布要对中国AI软 ...
- tensorflow张量限幅
本篇内容有clip_by_value.clip_by_norm.gradient clipping 1.tf.clip_by_value a = tf.range(10) print(a) # if ...
- 集合使用 Iterator 删除元素
针对常见的数据集合,比如 ArrayList 列表,对其进行遍历,删除其中符合条件的某个元素,使用 iterator 迭代器进行迭代,代码如下: public class PracticeContro ...
- 04-SV连接设计和测试平台
1.验证一个设计的步骤: 生成输入激励,捕捉输出响应,决定对错和进度 2.连接设计和测试平台 信号连接:SystemVerilog已经扩展了传统的reg类型,可以像wire那样用来连接模块,它的新名字 ...
- aws申请ec2实例后如何用root用户登录
ec2默认禁用root用户登录,我们创建ec2实例后如何知道使用什么用户登录,有两种方法? 方法一:根据我们选择的镜像来判断用什么用户登录:镜像:centos 用户centos镜像:aws 用户:ec ...
- Java数组动态增加容量
Java数组初始化需要指定数组容量,但是在许多情况下需要动态扩充容量.有两种方法可以实现:1.采用ArrayList类数组,它可以在需要时自动扩容:2.采用System.arraycopy方法实现,其 ...
- CLOUD将excel数据引入单据体
http://club.kingdee.com/forum.php?mod=viewthread&tid=989239 http://club.kingdee.com/forum.php?mo ...
- 论文阅读笔记(三)【AAAI2017】:Learning Heterogeneous Dictionary Pair with Feature Projection Matrix for Pedestrian Video Retrieval via Single Query Image
Introduction (1)IVPR问题: 根据一张图片从视频中识别出行人的方法称为 image to video person re-id(IVPR) 应用: ① 通过嫌犯照片,从视频中识别出嫌 ...