Home Database Mysql Tutorial 第一次codeforces竞技结束 #238 Div 2

第一次codeforces竞技结束 #238 Div 2

Jun 07, 2016 pm 03:07 PM
div Finish

Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix. The dot product of two integer number vectors x and y of size n is the sum of the products of the correspondi

Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.

The dot product of two integer number vectors x and y of size n is the sum of the products of the corresponding components of the vectors. Theunusual square of an n?×?n square matrix A is defined as the sum of n dot products. The i-th of them is the dot product of the i-th row vector and the i-th column vector in the matrix A.

Fortunately for Chris, he has to work only in GF(2)! This means that all operations (addition, multiplication) are calculated modulo 2. In fact, the matrix A is binary: each element of A is either 0 or 1. For example, consider the following matrix A:

第一次codeforces竞技结束 #238 Div 2

The unusual square of A is equal to (1·1?+?1·0?+?1·1)?+?(0·1?+?1·1?+?1·0)?+?(1·1?+?0·1?+?0·0)?=?0?+?1?+?1?=?0.

However, there is much more to the homework. Chris has to process q queries; each query can be one of the following:

  1. given a row index i, flip all the values in the i-th row in A;
  2. given a column index i, flip all the values in the i-th column in A;
  3. find the unusual square of A.

To flip a bit value w means to change it to 1?-?w, i.e., 1 changes to 0 and 0 changes to 1.

Given the initial matrix A, output the answers for each query of the third type! Can you solve Chris's homework?

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

When will Teamfight Tactics S11 end? When will Teamfight Tactics S11 end? Mar 18, 2024 pm 03:16 PM

When will Teamfight Tactics S11 end?

How to quickly turn off the shortcut keys running in the background of Win11? How to quickly turn off the shortcut keys running in the background of Win11? Dec 28, 2023 am 09:54 AM

How to quickly turn off the shortcut keys running in the background of Win11?

How to use computer task manager shortcut keys to end a task How to use computer task manager shortcut keys to end a task Jan 02, 2024 pm 01:34 PM

How to use computer task manager shortcut keys to end a task

How to end a meeting in Tencent Meeting - specific operations for ending a meeting in Tencent Meeting How to end a meeting in Tencent Meeting - specific operations for ending a meeting in Tencent Meeting Mar 05, 2024 pm 12:16 PM

How to end a meeting in Tencent Meeting - specific operations for ending a meeting in Tencent Meeting

How to use css to realize that a div is missing a corner How to use css to realize that a div is missing a corner Jan 30, 2023 am 09:23 AM

How to use css to realize that a div is missing a corner

Implementation of word-marking translation browser script based on ChatGPT API Implementation of word-marking translation browser script based on ChatGPT API May 01, 2023 pm 03:28 PM

Implementation of word-marking translation browser script based on ChatGPT API

What are the differences between div and span? What are the differences between div and span? Nov 02, 2023 pm 02:29 PM

What are the differences between div and span?

What is the div box model What is the div box model Oct 09, 2023 pm 05:15 PM

What is the div box model

See all articles