Solutions are presented as using the least memory and the fastest execution time. It also takes the top
10 most recent solutions from each language. If you want to limit to a specific index, click the
"Solved" button and go to that problem.
Problems
B'You have a square chessboard of size n x n . Rows are numbered from top to bottom with numbers from 1 to n , and columns -- from left to right with numbers from 1 to n . So, each cell is denoted with pair of integers (x, y) ( 1 <= x, y <= n ), where x is a row number and y is a column number. You have to perform q queries of three types: Subrectangle is a set of cells (x, y) such that for each cell two conditions are satisfied: x_1 <= x <= x_2 and y_1 <= y <= y_2 . Recall that cell (a, b) is attacked by a rook placed in cell (c, d) if either a = c or b = d . In particular, the cell containing a rook is attacked by this rook. The first line contains two integers n and q ( 1 <= n <= 10^5 , 1 <= q <= 2 cdot 10^5 ) -- the size of the chessboard and the number of queries, respectively. Each of the following q lines contains description of a query. Description begins with integer t ( t in {1, 2, 3 } ) which denotes type of a query: It 's guaranteed that among q queries there is at least one query of the third type. Print the answer for each query of the third type in a separate line. Print "Yes" (without quotes) if each cell of the subrectangle is attacked by at least one rook. Otherwise print "No" (without quotes). Consider example. After the first two queries the board will look like the following picture (the letter R denotes cells in which rooks are located, the subrectangle of the query of the third type is highlighted in green): Chessboard after performing the third and the fourth queries: Chessboard after performing the fifth and the sixth queries: Chessboard after performing the seventh and the eighth queries: Chessboard after performing the last two queries: '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
157196413 |
avtoruxadze |
C |
May 14, 2022, 11:25 a.m. |
OK |
C# 8 |
TESTS |
48 |
811 |
9011200 |
|
|
157227394 |
ruban |
C |
May 14, 2022, 4:08 p.m. |
OK |
Delphi |
TESTS |
48 |
390 |
23449600 |
|
|
157227333 |
ruban |
C |
May 14, 2022, 4:08 p.m. |
OK |
Delphi |
TESTS |
48 |
467 |
47001600 |
|
|
157227277 |
ruban |
C |
May 14, 2022, 4:07 p.m. |
OK |
FPC |
TESTS |
48 |
779 |
47001600 |
|
|
157230744 |
duoluoluo |
C |
May 14, 2022, 4:44 p.m. |
OK |
GNU C++14 |
TESTS |
48 |
156 |
1638400 |
|
|
157223398 |
Worldwide_D |
C |
May 14, 2022, 3:29 p.m. |
OK |
GNU C++14 |
TESTS |
48 |
171 |
1638400 |
|
|
157227232 |
Commonrain |
C |
May 14, 2022, 4:07 p.m. |
OK |
GNU C++14 |
TESTS |
48 |
171 |
3174400 |
|
|
157214333 |
xing89qs |
C |
May 14, 2022, 2:08 p.m. |
OK |
GNU C++14 |
TESTS |
48 |
171 |
5222400 |
|
|
157254046 |
lmj_010308 |
C |
May 15, 2022, 2:52 a.m. |
OK |
GNU C++14 |
TESTS |
48 |
171 |
6451200 |
|
|
157200177 |
starcat |
C |
May 14, 2022, 11:34 a.m. |
OK |
GNU C++14 |
TESTS |
48 |
186 |
1638400 |
|
|
157219844 |
jiangnanmost |
C |
May 14, 2022, 2:55 p.m. |
OK |
GNU C++14 |
TESTS |
48 |
186 |
3174400 |
|
|
157208665 |
not_ashutosh1845 |
C |
May 14, 2022, 1:07 p.m. |
OK |
GNU C++14 |
TESTS |
48 |
187 |
1638400 |
|
|
157209165 |
Ouni_Poppy |
C |
May 14, 2022, 1:11 p.m. |
OK |
GNU C++14 |
TESTS |
48 |
187 |
2457600 |
|
|
157249508 |
wangzeyu0922 |
C |
May 14, 2022, 11:48 p.m. |
OK |
GNU C++14 |
TESTS |
48 |
187 |
2662400 |
|
|
157249804 |
RBS |
C |
May 15, 2022, 12:01 a.m. |
OK |
GNU C++17 |
TESTS |
48 |
46 |
2764800 |
|
|
157209696 |
notrandom |
C |
May 14, 2022, 1:15 p.m. |
OK |
GNU C++17 |
TESTS |
48 |
171 |
3174400 |
|
|
157220528 |
Beginner343 |
C |
May 14, 2022, 3:01 p.m. |
OK |
GNU C++17 |
TESTS |
48 |
171 |
4812800 |
|
|
157253075 |
2375585710 |
C |
May 15, 2022, 2:25 a.m. |
OK |
GNU C++17 |
TESTS |
48 |
186 |
1638400 |
|
|
157219900 |
reknis |
C |
May 14, 2022, 2:55 p.m. |
OK |
GNU C++17 |
TESTS |
48 |
186 |
3174400 |
|
|
157261686 |
qwertyyuu |
C |
May 15, 2022, 5:29 a.m. |
OK |
GNU C++17 |
TESTS |
48 |
186 |
4300800 |
|
|
157253894 |
yzyyds |
C |
May 15, 2022, 2:49 a.m. |
OK |
GNU C++17 |
TESTS |
48 |
187 |
1638400 |
|
|
157208435 |
DeaphetS |
C |
May 14, 2022, 1:06 p.m. |
OK |
GNU C++17 |
TESTS |
48 |
187 |
1638400 |
|
|
157204796 |
Sempr |
C |
May 14, 2022, 12:43 p.m. |
OK |
GNU C++17 |
TESTS |
48 |
187 |
1638400 |
|
|
157212405 |
anodiebird |
C |
May 14, 2022, 1:44 p.m. |
OK |
GNU C++17 |
TESTS |
48 |
187 |
3174400 |
|
|
157233404 |
shirley_ |
C |
May 14, 2022, 5:14 p.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
62 |
6656000 |
|
|
157232922 |
shirley_ |
C |
May 14, 2022, 5:09 p.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
62 |
6656000 |
|
|
157230555 |
shirley_ |
C |
May 14, 2022, 4:42 p.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
77 |
7475200 |
|
|
157240081 |
Lucina |
C |
May 14, 2022, 6:45 p.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
139 |
1638400 |
|
|
157208977 |
Havoc_01 |
C |
May 14, 2022, 1:09 p.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
139 |
2457600 |
|
|
157262537 |
Feintl |
C |
May 15, 2022, 5:42 a.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
139 |
2867200 |
|
|
157204908 |
RetsaZC19 |
C |
May 14, 2022, 12:44 p.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
139 |
6451200 |
|
|
157222943 |
purushottam_1048 |
C |
May 14, 2022, 3:24 p.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
140 |
1638400 |
|
|
157217070 |
_Pioneer |
C |
May 14, 2022, 2:31 p.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
140 |
1638400 |
|
|
157246967 |
pasthec |
C |
May 14, 2022, 10:12 p.m. |
OK |
GNU C++17 (64) |
TESTS |
48 |
140 |
4505600 |
|
|
remove filters
Back to search problems