题意

题目链接

Sol

Orz SovitPower

#include<bits/stdc++.h>
#define Pair pair<int, double>
#define MP(x, y) make_pair(x, y)
#define fi first
#define se second
//#define int long long
#define LL long long
#define Fin(x) {freopen(#x".in","r",stdin);}
#define Fout(x) {freopen(#x".out","w",stdout);}
using namespace std;
const int MAXN = 1e6 + 10, mod = 998244353, INF = 2e9 + 10;
const double eps = 1e-9;
template <typename A, typename B> inline bool chmin(A &a, B b){if(a > b) {a = b; return 1;} return 0;}
template <typename A, typename B> inline bool chmax(A &a, B b){if(a < b) {a = b; return 1;} return 0;}
template <typename A, typename B> inline LL add(A x, B y) {if(x + y < 0) return x + y + mod; return x + y >= mod ? x + y - mod : x + y;}
template <typename A, typename B> inline void add2(A &x, B y) {if(x + y < 0) x = x + y + mod; else x = (x + y >= mod ? x + y - mod : x + y);}
template <typename A, typename B> inline LL mul(A x, B y) {return 1ll * x * y % mod;}
template <typename A, typename B> inline void mul2(A &x, B y) {x = (1ll * x * y % mod + mod) % mod;}
template <typename A> inline void debug(A a){cout << a << '\n';}
template <typename A> inline LL sqr(A x){return 1ll * x * x;}
inline int read() {
char c = getchar(); int x = 0, f = 1;
while(c < '0' || c > '9') {if(c == '-') f = -1; c = getchar();}
while(c >= '0' && c <= '9') x = x * 10 + c - '0', c = getchar();
return x * f;
}
int N, a[MAXN];
signed main() {
N = read();
for(int i = 1; i <= N; i++) a[i] = read();
sort(a + 1, a + N + 1, greater<int>());
for(int i = 1; i <= N; i++) {
if(i + 1 > a[i + 1]) {
if((a[i] - i) & 1) {puts("First"); return 0;}
int j;
for(j = i + 1; a[j] == i; j++);
if(!((j - i) & 1)) {puts("First"); return 0;}
puts("Second"); return 0;
}
}
return 0;
}

agc002E - Candy Piles(博弈论)的更多相关文章

  1. AtCoder AGC002E Candy Piles (博弈论)

    神仙题..表示自己智商不够想不到... 好几次读成最后拿的赢了,导致一直没看懂题解... 题目链接: https://atcoder.jp/contests/agc002/tasks/agc002_e ...

  2. [Agc002E]Candy Piles

    [Agc002E]Candy Piles 题目大意 有\(n\)个数,两人轮流操作,可以做以下操作之一: 删掉一个最大的数 将所有数-1 最后取没的人输,问先手是否必胜? 试题分析 直接决策不知道选哪 ...

  3. 【AGC002E】Candy Piles 博弈论

    题目大意 有\(n\)堆糖果,第\(i\)堆有\(a_i\)个. 两个人轮流决策,决策分为两种: 1.选择糖果数最多的一堆糖果,并把这堆糖全吃了. 2.在每堆非空的糖果堆里拿一颗糖吃掉. 吃掉最后一颗 ...

  4. [Agc002E/At1999] Candy Piles - 博弈论

    有n堆石子,第i堆有ai个石子.有两种操作: 把石子最多的那一堆给丢掉 把每一堆全部丢掉一个 谁拿走最后石子谁输.判断胜负情况. 直觉转化为一个走棋盘问题 考虑如何计算左下角点的状态 找到原点最右上方 ...

  5. AGC 002E.Candy Piles(博弈论)

    题目链接 \(Description\) 给定\(n\)堆糖,数量分别为\(a_i\).Alice和Bob轮流操作.每次可以吃掉最多的一堆,也可以每堆各吃掉一个.无法操作的人输,求谁能赢. \(n\l ...

  6. [atcoder002E] Candy Piles [博弈论]

    题面: 传送门 思路: 每一堆糖排成一列,所有列横着放,形成一个阶梯型 两个决策相当于左边一列去掉和最下面一行去掉 那么这个模型可以转化为同样形状的网格图,向左上方走,走到边界的赢· 然后一波数学推导 ...

  7. @atcoder - AGC002E@ Candy Piles

    目录 @description@ @solution@ @accepted code@ @details@ @description@ 给定 N 堆糖果,第 i 堆包含 ai 个糖果. 现在两人进行博 ...

  8. AtCoder - 1999 Candy Piles

    Problem Statement There are N piles of candies on the table. The piles are numbered 1 through N. At ...

  9. 【AGC002 E】Candy Piles

    本来实在写不动这题 sol 了,但一想这是个经典的模型转化问题,于是就写了(.jpg) 题意 有一个序列 \(a_i\). 两人轮流操作,每次操作为二选一: 1. 把最大的 \(a_i\) 减成 \( ...

随机推荐

  1. Day4:html和css

    Day4:html和css 规范注意 链接里面不能再放链接. a里面可以放入块级元素. 空格规范 选择器与{之间必须包含空格. 如: .class {} 属性名与之后的:符号之间不允许包含空格, 而: ...

  2. idea 过段时间java程序包不存在问题 ?

    有时候我们在导入程序之后,系统会给出错误提示:Java:程序包xxxx不存在,现在我这里有一招,就是使用IDEA自动导入Java程序包,这也是IDEA的一大优点. 但是在看到这个问题的文章的时候,并不 ...

  3. PHP拿到接口数据返回的json以及传参-----ajax 跨域请求 ---

    以下测试------ <php $ch = curl_init(); $str = '';//此处为接口地址以及传参------- curl_setopt($ch, CURLOPT_URL, $ ...

  4. 一个致命的 Redis 命令,导致公司损失 400 万!!

    最近安全事故濒发啊,前几天发生了<顺丰高级运维工程师的删库事件>,今天又看到了 PHP 工程师在线执行了 Redis 危险命令导致某公司损失 400 万.. 什么样的 Redis 命令会有 ...

  5. LSTMs和递归神经网络的初学者指南

    本文是读A Beginner's Guide to LSTMs and Recurrent Neural Networks的个人摘要. 递归网络 Recurrent nets 递归网络是一种人工神经网 ...

  6. 远程计算机或设备将不接受连接(电脑能连接网络、QQ能登陆、浏览器无法使用)

    第一种方法 1.win+r 2.输入regedit,打开注册表 3.查找Internet Settings(在HKEY_CURRENT_USER\Software\Microsoft\Windows\ ...

  7. AspNetCore微服务下的网关-Kong(一)

    Kong是Mashape开源的高性能高可用API网关和API服务管理层.它基于OpenResty,进行API管理,并提供了插件实现API的AOP.Kong在Mashape 管理了超过15,000 个A ...

  8. 部署 YApi 接口管理服务

    安装 Node curl -sL https://rpm.nodesource.com/setup_8.x | bash - yum install -y nodejs 安装 MongoDB vi / ...

  9. css的direction属性

    在项目中有遇到一个问题,select元素中的文字需要右对齐.text-align是无效的,想了很久都没有想到办法.经过一翻搜索之后发现了https://stackoverflow.com/questi ...

  10. Struts1入门实例(简单登录)

    Struts1入门实例(简单登录) 现在开始加入公司的核心项目,但由于项目开发比较早,所以使用的技术不是很新潮,前台用的还是struts1. 虽然不是什么新技术,但仍可以从中学到好多东西的.花了一个晚 ...