Bestcoders 56 Clarke and puzzle

Clarke and puzzle

 
 Accepts: 129
 
 Submissions: 322
 Time Limit: 4000/2000 MS (Java/Others)
 
 Memory Limit: 65536/65536 K (Java/Others)
Problem Description

Clarke is a patient with multiple personality disorder. One day, Clarke split into two personality aa and bb, they are playing a game.
There is a n*mnm matrix, each grid of this matrix has a number c_{i, j}ci,j.
aa wants to beat bb every time, so aa ask you for a help.
There are qq operations, each of them is belonging to one of the following two types:

  1. They play the game on a (x_1, y_1)-(x_2, y_2)(x1,y1)(x2,y2) sub matrix. They take turns operating. On any turn, the player can choose a grid which has a positive integer from the sub matrix and decrease it by a positive integer which less than or equal this grid's number. The player who can't operate is loser. aa always operate first, he wants to know if he can win this game.
  2. Change c_{i, j}ci,j to bb.
Input

The first line contains a integer T(1 \le T \le 5)T(1T5), the number of test cases.
For each test case:
The first line contains three integers n, m, q(1 \le n, m \le 500, 1 \le q \le 2*10^5)n,m,q(1n,m500,1q2105)
Then n*mnm matrix follow, the ii row jj column is a integer c_{i, j}(0 \le c_{i, j} \le 10^9)ci,j(0ci,j109)
Then qq lines follow, the first number is optopt.
if opt=1opt=1, then 44 integers x_1, y_1, x_1, y_2(1 \le x_1 \le x_2 \le n, 1 \le y_1 \le y_2 \le m)x1,y1,x1,y2(1x1x2n,1y1y2m) follow, represent operation 11.
if opt=2opt=2, then 33 integers i, j, bi,j,b follow, represent operation 22.

Output

For each testcase, for each operation 11, print YesYes if aa can win this game, otherwise print NoNo.

Sample Input
1
1 2 3
1 2
1 1 1 1 2
2 1 2 1
1 1 1 1 2
Sample Output
Yes
No

Hint:
The first enquiry: aa can decrease grid (1, 2)(1,2)'s number by 11. No matter what bb operate next, there is always one grid with number 11 remaining . So, aa wins.
The second enquiry: No matter what aa operate, there is always one grid with number 11 remaining. So, bb wins.


#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;
#define N 500 + 5

int n, m, q;
int c[N][N];
int sum[N][N];

inline int lowbit(int x)
{
    return x & (-x);
}

void update(int x, int y, int data)
{
    for(int i = x; i <= n; i += lowbit(i))
        for(int j = y; j <= m; j += lowbit(j))
        sum[i][j] ^= data;
}

int get_sum(int x, int y)
{
    int res = 0;
    for(int i = x; i > 0; i -= lowbit(i))
        for(int j = y; j > 0; j -= lowbit(j))
        res ^= sum[i][j];
    return res;
}

int main()
{
    int T;
    scanf("%d", &T);
    while(T--)
    {
        memset(sum, 0, sizeof sum);
        scanf("%d%d%d", &n, &m, &q);

        for(int i = 1; i <= n ; i++)
            for(int j = 1; j <= m; j++)
            {
                scanf("%d", &c[i][j]);
                update(i, j, c[i][j]);
            }

        int x1, x2, y1, y2, op;
        while(q--)
        {
            scanf("%d", &op);
            if(op == 1)
            {
                scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
                int ans = 0;
                ans = get_sum(x2, y2) ^ get_sum(x1 - 1, y1 - 1) ^ get_sum(x2, y1 - 1) ^ get_sum(x1 - 1, y2);
                (ans == 0) ? printf("No\n") : printf("Yes\n");
            }
            else
            {
                scanf("%d%d%d", &x1, &y1, &x2);
                update(x1, y1, c[x1][y1] ^ x2);
                c[x1][y1] = x2;
            }
        }
    }
    return 0;
}

/*

1
3 3 10
1 1 1
1 1 1
1 1 1



*/


资源下载链接为: https://pan.quark.cn/s/22ca96b7bd39 在当今的软件开发领域,自动化构建与发布是提升开发效率和项目质量的关键环节。Jenkins Pipeline作为一种强大的自动化工具,能够有效助力Java项目的快速构建、测试及部署。本文将详细介绍如何利用Jenkins Pipeline实现Java项目的自动化构建与发布。 Jenkins Pipeline简介 Jenkins Pipeline是运行在Jenkins上的一套工作流框架,它将原本分散在单个或多个节点上独立运行的任务串联起来,实现复杂流程的编排与可视化。它是Jenkins 2.X的核心特性之一,推动了Jenkins从持续集成(CI)向持续交付(CD)及DevOps的转变。 创建Pipeline项目 要使用Jenkins Pipeline自动化构建发布Java项目,首先需要创建Pipeline项目。具体步骤如下: 登录Jenkins,点击“新建项”,选择“Pipeline”。 输入项目名称和描述,点击“确定”。 在Pipeline脚本中定义项目字典、发版脚本和预发布脚本。 编写Pipeline脚本 Pipeline脚本是Jenkins Pipeline的核心,用于定义自动化构建和发布的流程。以下是一个简单的Pipeline脚本示例: 在上述脚本中,定义了四个阶段:Checkout、Build、Push package和Deploy/Rollback。每个阶段都可以根据实际需求进行配置和调整。 通过Jenkins Pipeline自动化构建发布Java项目,可以显著提升开发效率和项目质量。借助Pipeline,我们能够轻松实现自动化构建、测试和部署,从而提高项目的整体质量和可靠性。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值