ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

第十二篇英语翻译

2022-01-29 17:04:07  阅读:237  来源: 互联网

标签:第十二 英语翻译 seat paint Tina seats test Rahul


 

出处:https://acs.jxnu.edu.cn/contest/23/board/challenge/B

Not Sitting

描述:

Rahul and Tina are looking forward to starting their new year at college. As they enter their new classroom, they observe the seats of students are arranged in a n×mn×m grid. The seat in row rr and column cc is denoted by (r,c)(r,c), and the distance between two seats (a,b)(a,b) and (c,d)(c,d) is |a−c|+|b−d||a−c|+|b−d|.

As the class president, Tina has access to exactly kk buckets of pink paint. The following process occurs.

  • First, Tina chooses exactly kk seats in the classroom to paint with pink paint. One bucket of paint can paint exactly one seat.
  • After Tina has painted kk seats in the previous step, Rahul chooses where he sits. He will not choose a seat that has been painted pink due to his hatred of the colour pink.
  • After Rahul has chosen his seat, Tina chooses a seat for herself. She can choose any of the seats, painted or not, other than the one chosen by Rahul.

Rahul wants to choose a seat such that he sits as close to Tina as possible. However, Tina wants to sit as far away from Rahul as possible due to some complicated relationship history that we couldn't fit into the statement!

Now, Rahul wonders for k=0,1,…,n⋅m−1k=0,1,…,n⋅m−1, if Tina has kk buckets of paint, how close can Rahul sit to Tina, if both Rahul and Tina are aware of each other's intentions and they both act as strategically as possible? Please help satisfy Rahul's curiosity!

输入:

The input consists of multiple test cases. The first line contains an integer tt (1≤t≤5⋅1041≤t≤5⋅104) — the number of test cases. The description of the test cases follows.

The first line of each test case contains two integers nn, mm (2≤n⋅m≤1052≤n⋅m≤105) — the number of rows and columns of seats in the classroom.

The sum of n⋅mn⋅m across all test cases does not exceed 105105.

输出:

For each test case, output n⋅mn⋅m ordered integers — the distance between Rahul and Tina if both of them act optimally for every k∈[0,n⋅m−1]k∈[0,n⋅m−1].

样例输入:

2
4 3
1 2

样例输出:

3 3 4 4 4 4 4 4 5 5 5 5 
1 1 

标签:第十二,英语翻译,seat,paint,Tina,seats,test,Rahul
来源: https://www.cnblogs.com/cilinmengye/p/15855391.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有