[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 - 博弈论的更多相关文章

  1. 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 ...

  2. Codeforces 1220C. Substring Game in the Lesson

    传送门 首先显然的,如果 $l$ 能移动,那么 $r$ 一定可以随便移动,如果 $l$ 不动,那么 $r$ 一定不能动 那么我们现在只要考虑 $l$ 的移动即可 考虑找到位置 $k$ 之前的最左边的最 ...

  3. Codeforces Round #586 (Div. 1 + Div. 2)

    传送门 A. Cards 记录一下出现的个数就行. Code #include <bits/stdc++.h> #define MP make_pair #define fi first ...

  4. Codeforces Round #586

    目录 Contest Info A. Cards B. Multiplication Table C. Substring Game in the Lesson D. Alex and Julian ...

  5. LeetCode[3] Longest Substring Without Repeating Characters

    题目描述 Given a string, find the length of the longest substring without repeating characters. For exam ...

  6. 最长回文子串-LeetCode 5 Longest Palindromic Substring

    题目描述 Given a string S, find the longest palindromic substring in S. You may assume that the maximum ...

  7. POJ3693 Maximum repetition substring [后缀数组 ST表]

    Maximum repetition substring Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9458   Acc ...

  8. [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 ...

  9. 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 ...

随机推荐

  1. SpringBoot项目自定义浏览器选项卡左上角图标(favicon.ico)-sunziren

    favicon.ico是浏览器选项卡左上角的图标,可以放在静态资源路径下或者类路径下面.静态资源路径下的favicon.ico优先级高于类路径下的favicon.ico. 可以使用在线转换网站http ...

  2. 使用Python库paramiko登录远程设备

    前言 手动下载paramiko库的安装包.在PyPi库中查找即可,但是不到是我的电脑问题还是网络问题,2.0.0以上版本我都安装不了,因此我自己是安装的paramiko 1.17.0版本,此版本经过测 ...

  3. 2020 kali linux 4 安装搜狗输入法

    kali linux 安装搜狗输入法之坑! 官方源: deb http://http.kali.org/kali kali-rolling main non-free contrib 国内源: deb ...

  4. 42.通过原生SQL语句进行操纵mysql数据库

    views.py文件中: from django.shortcuts import render # 导入connection模块 from django.db import connection d ...

  5. 使用css鼠标移动到图片放大效果

      <!DOCTYPE html>  <html>      <head>          <meta charset="UTF-8"& ...

  6. ng-指令

    在 Angular 中最常用的指令分为两种,它们分别是 属性型指令 和 结构型指令. NgClass 作用:添加或移除一组 CSS 类 NgStyle 作用:添加或移除一组 CSS 样式 NgMode ...

  7. Exec msdb.dbo.sp_send_dbmail 参数详解(SQL Server 存储过程发邮件)

    转载oriency755 发布于2012-12-04 11:34:45 阅读数 6870 收藏   sp_send_dbmail [ [ @profile_name = ] 'profile_name ...

  8. APFS 宗卷 • APFS(加密)磁盘格式怎么去掉?Mac磁盘加密怎么解除?

    相信很多朋友都因为APFS 宗卷 • APFS(加密)磁盘格式而困扰,这种磁盘加密,导致很多破解版软件都不能安装.那么磁盘加密怎么解除?小编翻阅了一些教程,为您带来APFS 宗卷 • APFS(加密) ...

  9. PTA 1004 Counting Leaves

    题目描述: A family hierarchy is usually presented by a pedigree tree. Your job is to count those family ...

  10. 野路子码农系列(8)我终于大致搞懂了GBDT

    由于下下周要在组里介绍一个算法,最近开始提前准备,当初非常自信地写下自己最喜欢的GBDT,但随着逐步深入,发现其实自己对这个算法的细节并不是非常了解,了解的只是一些面试题的答案而已……(既然没有深入了 ...