| |
|
开发:
C++知识库
Java知识库
JavaScript
Python
PHP知识库
人工智能
区块链
大数据
移动开发
嵌入式
开发工具
数据结构与算法
开发测试
游戏开发
网络协议
系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程 数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁 |
-> 游戏开发 -> E. Gojou and Matrix Game -> 正文阅读 |
|
[游戏开发]E. Gojou and Matrix Game |
E. Gojou and Matrix Game time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Marin feels exhausted after a long day of cosplay, so Gojou invites her to play a game! Marin and Gojou take turns to place one of their tokens on an?n×nn×n?grid with Marin starting first. There are some restrictions and allowances on where to place tokens:
Whenever a player places a token on cell?(x,y)(x,y), that player gets?vx,?yvx,?y?points. All values of?vv?on the grid are?distinct. You still get points from a cell even if tokens were already placed onto the cell. The game finishes when each player makes?1010010100?moves. Marin and Gojou will play?n2n2?games. For each cell of the grid, there will be exactly one game where Marin places a token on that cell on her first move. Please answer for each game, if Marin and Gojou play optimally (after Marin's first move), who will have more points at the end? Or will the game end in a draw (both players have the same points at the end)? Input The first line contains two integers?nn,?kk?(3≤n≤20003≤n≤2000,?1≤k≤n?21≤k≤n?2). Note that under these constraints it is always possible to make a move. The following?nn?lines contains?nn?integers each. The?jj-th integer in the?ii-th line is?vi,jvi,j?(1≤vi,j≤n21≤vi,j≤n2). All elements in?vv?are distinct. Output You should print?nn?lines. In the?ii-th line, print?nn?characters, where the?jj-th character is the result of the game in which Marin places her first token in the cell?(i,j)(i,j). Print 'M' if Marin wins, 'G' if Gojou wins, and 'D' if the game ends in a draw. Do not print spaces between the characters in one line. Example input Copy 3 1 1 2 4 6 8 3 9 5 7 output Copy GGG MGG MGG ?
首先,找到肯定赢的位置,然后逐步扩散O(n) https://codeforces.com/blog/entry/101302? 这里还要转换一下距离的比较方式? |
|
|
上一篇文章 下一篇文章 查看所有文章 |
|
开发:
C++知识库
Java知识库
JavaScript
Python
PHP知识库
人工智能
区块链
大数据
移动开发
嵌入式
开发工具
数据结构与算法
开发测试
游戏开发
网络协议
系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程 数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁 |
360图书馆 购物 三丰科技 阅读网 日历 万年历 2025年1日历 | -2025/1/16 17:55:40- |
|
网站联系: qq:121756557 email:121756557@qq.com IT数码 |