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 are given a grid with n rows and m columns. We denote the square on the i -th ( 1 <= i <= n ) row and j -th ( 1 <= j <= m ) column by (i, j) and the number there by a_{ij} . All numbers are equal to 1 or to -1 . You start from the square (1, 1) and can move one square down or one square to the right at a time. In the end, you want to end up at the square (n, m) . Is it possible to move in such a way so that the sum of the values written in all the visited cells (including a_{11} and a_{nm} ) is 0 ? Each test contains multiple test cases. The first line contains the number of test cases t ( 1 <= q t <= q 10^4 ). Description of the test cases follows. The first line of each test case contains two integers n and m ( 1 <= n, m <= 1000 ) -- the size of the grid. Each of the following n lines contains m integers. The j -th integer on the i -th line is a_{ij} ( a_{ij} = 1 or -1 ) -- the element in the cell (i, j) . It is guaranteed that the sum of n cdot m over all test cases does not exceed 10^6 . For each test case, print "YES" if there exists a path from the top left to the bottom right that adds up to 0 , and "NO" otherwise. You can output each letter in any case. One possible path for the fourth test case is given in the picture in the statement. '... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
161128954 |
NenadDapic |
C |
June 18, 2022, 7:03 p.m. |
OK |
FPC |
TESTS |
47 |
155 |
4096000 |
|
|
161153930 |
Bobocan |
C |
June 19, 2022, 6 a.m. |
OK |
GNU C11 |
TESTS |
47 |
31 |
0 |
|
|
161142466 |
trassis |
C |
June 19, 2022, 1:39 a.m. |
OK |
GNU C11 |
TESTS |
47 |
140 |
11980800 |
|
|
161133626 |
gxlois |
C |
June 18, 2022, 8:23 p.m. |
OK |
GNU C11 |
TESTS |
47 |
140 |
11980800 |
|
|
161110948 |
YOK |
C |
June 18, 2022, 4:22 p.m. |
OK |
GNU C11 |
TESTS |
46 |
140 |
12083200 |
|
|
161121823 |
dean.menezes |
C |
June 18, 2022, 5:45 p.m. |
OK |
GNU C11 |
TESTS |
47 |
140 |
12288000 |
|
|
161151053 |
chinawcp |
C |
June 19, 2022, 5:16 a.m. |
OK |
GNU C11 |
TESTS |
47 |
156 |
12288000 |
|
|
161112654 |
chro4896 |
C |
June 18, 2022, 4:26 p.m. |
OK |
GNU C11 |
TESTS |
46 |
171 |
11980800 |
|
|
161118928 |
GTrigger |
C |
June 18, 2022, 5:28 p.m. |
OK |
GNU C11 |
TESTS |
46 |
202 |
11980800 |
|
|
161143742 |
cbdsopa |
C |
June 19, 2022, 2:22 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
31 |
13107200 |
|
|
161143733 |
Hatsune_MikuOvO |
C |
June 19, 2022, 2:22 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
124 |
12185600 |
|
|
161145031 |
Acestar |
C |
June 19, 2022, 2:59 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
124 |
12185600 |
|
|
161143106 |
MORETHINK |
C |
June 19, 2022, 2:03 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
124 |
12185600 |
|
|
161150242 |
krunal_078 |
C |
June 19, 2022, 5:02 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
140 |
8294400 |
|
|
161124775 |
monuchauhan212223 |
C |
June 18, 2022, 6:13 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
140 |
8704000 |
|
|
161127067 |
Jasonwei08 |
C |
June 18, 2022, 6:39 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
140 |
12185600 |
|
|
161145244 |
jzp2 |
C |
June 19, 2022, 3:05 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
140 |
12288000 |
|
|
161132700 |
mugiwara_2980 |
C |
June 18, 2022, 8:02 p.m. |
OK |
GNU C++14 |
TESTS |
47 |
140 |
12800000 |
|
|
161148881 |
huangbrother |
C |
June 19, 2022, 4:33 a.m. |
OK |
GNU C++14 |
TESTS |
47 |
140 |
12800000 |
|
|
161127050 |
cseruhulamin123 |
C |
June 18, 2022, 6:38 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
46 |
15462400 |
|
|
161153235 |
Bobocan |
C |
June 19, 2022, 5:49 a.m. |
OK |
GNU C++17 |
TESTS |
47 |
124 |
0 |
|
|
161153035 |
Bobocan |
C |
June 19, 2022, 5:46 a.m. |
OK |
GNU C++17 |
TESTS |
47 |
124 |
0 |
|
|
161144148 |
pkkkkkkk |
C |
June 19, 2022, 2:33 a.m. |
OK |
GNU C++17 |
TESTS |
47 |
124 |
12185600 |
|
|
161124028 |
DPMP1600 |
C |
June 18, 2022, 6:05 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
139 |
8704000 |
|
|
161141632 |
test324324 |
C |
June 19, 2022, 1:09 a.m. |
OK |
GNU C++17 |
TESTS |
47 |
139 |
12288000 |
|
|
161136034 |
DeadPixel99 |
C |
June 18, 2022, 9:20 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
139 |
12595200 |
|
|
161140205 |
user256 |
C |
June 19, 2022, 12:03 a.m. |
OK |
GNU C++17 |
TESTS |
47 |
139 |
12800000 |
|
|
161129512 |
useashu |
C |
June 18, 2022, 7:11 p.m. |
OK |
GNU C++17 |
TESTS |
47 |
139 |
12902400 |
|
|
161149128 |
kunjan255 |
C |
June 19, 2022, 4:38 a.m. |
OK |
GNU C++17 |
TESTS |
47 |
140 |
4300800 |
|
|
161115618 |
LiZnB |
C |
June 18, 2022, 4:32 p.m. |
OK |
GNU C++17 (64) |
TESTS |
46 |
31 |
29696000 |
|
|
161142614 |
TrendBattles |
C |
June 19, 2022, 1:45 a.m. |
OK |
GNU C++17 (64) |
TESTS |
47 |
109 |
7987200 |
|
|
161147021 |
clinging |
C |
June 19, 2022, 3:51 a.m. |
OK |
GNU C++17 (64) |
TESTS |
47 |
109 |
8089600 |
|
|
161145429 |
qwynick |
C |
June 19, 2022, 3:11 a.m. |
OK |
GNU C++17 (64) |
TESTS |
47 |
124 |
3993600 |
|
|
161133189 |
alwyn |
C |
June 18, 2022, 8:13 p.m. |
OK |
GNU C++17 (64) |
TESTS |
47 |
124 |
4403200 |
|
|
161136707 |
alwyn |
C |
June 18, 2022, 9:40 p.m. |
OK |
GNU C++17 (64) |
TESTS |
47 |
124 |
4608000 |
|
|
161142486 |
keshavraj77 |
C |
June 19, 2022, 1:40 a.m. |
OK |
GNU C++17 (64) |
TESTS |
47 |
124 |
7987200 |
|
|
161139334 |
OnMyZenith |
C |
June 18, 2022, 11:23 p.m. |
OK |
GNU C++17 (64) |
TESTS |
47 |
124 |
8601600 |
|
|
161123594 |
izlyforever |
C |
June 18, 2022, 6:01 p.m. |
OK |
GNU C++17 (64) |
TESTS |
47 |
124 |
8704000 |
|
|
161131907 |
Youssef.Errais |
C |
June 18, 2022, 7:48 p.m. |
OK |
GNU C++17 (64) |
TESTS |
47 |
124 |
11980800 |
|
|
161145243 |
1brief |
C |
June 19, 2022, 3:05 a.m. |
OK |
GNU C++20 (64) |
TESTS |
47 |
93 |
12083200 |
|
|
161141901 |
Fangs |
C |
June 19, 2022, 1:19 a.m. |
OK |
GNU C++20 (64) |
TESTS |
47 |
93 |
16179200 |
|
|
161143148 |
shash4321 |
C |
June 19, 2022, 2:05 a.m. |
OK |
GNU C++20 (64) |
TESTS |
47 |
109 |
4403200 |
|
|
161136435 |
harryzhengipsum |
C |
June 18, 2022, 9:30 p.m. |
OK |
GNU C++20 (64) |
TESTS |
47 |
109 |
6041600 |
|
|
161152468 |
MOVSES1 |
C |
June 19, 2022, 5:38 a.m. |
OK |
GNU C++20 (64) |
TESTS |
47 |
109 |
7987200 |
|
|
161152154 |
MOVSES1 |
C |
June 19, 2022, 5:33 a.m. |
OK |
GNU C++20 (64) |
TESTS |
47 |
109 |
7987200 |
|
|
161120373 |
sahil_08 |
C |
June 18, 2022, 5:35 p.m. |
OK |
GNU C++20 (64) |
TESTS |
47 |
109 |
7987200 |
|
|
161124925 |
Nea1 |
C |
June 18, 2022, 6:14 p.m. |
OK |
GNU C++20 (64) |
TESTS |
47 |
109 |
8704000 |
|
|
161125356 |
piyusheverhard |
C |
June 18, 2022, 6:19 p.m. |
OK |
GNU C++20 (64) |
TESTS |
47 |
109 |
8704000 |
|
|
161138352 |
depOIder |
C |
June 18, 2022, 10:42 p.m. |
OK |
GNU C++20 (64) |
TESTS |
47 |
109 |
11980800 |
|
|
161123927 |
koqo |
C |
June 18, 2022, 6:04 p.m. |
OK |
Go |
TESTS |
47 |
327 |
14438400 |
|
|
161122024 |
dunkingdonuts |
C |
June 18, 2022, 5:47 p.m. |
OK |
Java 11 |
TESTS |
47 |
202 |
6041600 |
|
|
161127889 |
deepaksach |
C |
June 18, 2022, 6:49 p.m. |
OK |
Java 11 |
TESTS |
47 |
202 |
6348800 |
|
|
161126406 |
pili |
C |
June 18, 2022, 6:31 p.m. |
OK |
Java 11 |
TESTS |
47 |
217 |
6144000 |
|
|
161113433 |
N_LogN |
C |
June 18, 2022, 4:28 p.m. |
OK |
Java 11 |
TESTS |
46 |
233 |
17715200 |
|
|
161126404 |
henrychenOutlook |
C |
June 18, 2022, 6:31 p.m. |
OK |
Java 11 |
TESTS |
47 |
264 |
5222400 |
|
|
161147924 |
ChiNhan |
C |
June 19, 2022, 4:12 a.m. |
OK |
Java 11 |
TESTS |
47 |
264 |
6041600 |
|
|
161145113 |
aditya2024 |
C |
June 19, 2022, 3:01 a.m. |
OK |
Java 11 |
TESTS |
47 |
265 |
5222400 |
|
|
161134975 |
themadknight45 |
C |
June 18, 2022, 8:54 p.m. |
OK |
Java 11 |
TESTS |
47 |
265 |
6963200 |
|
|
161145813 |
parth_13_ |
C |
June 19, 2022, 3:22 a.m. |
OK |
Java 11 |
TESTS |
47 |
265 |
15872000 |
|
|
161149032 |
SkadiTheCorruptHeart |
C |
June 19, 2022, 4:36 a.m. |
OK |
Java 11 |
TESTS |
47 |
280 |
5222400 |
|
|
161110712 |
adi_7861 |
C |
June 18, 2022, 4:21 p.m. |
OK |
Java 8 |
TESTS |
46 |
171 |
17100800 |
|
|
161121956 |
AndreySiunov |
C |
June 18, 2022, 5:46 p.m. |
OK |
Java 8 |
TESTS |
47 |
187 |
4403200 |
|
|
161141504 |
MerickBao |
C |
June 19, 2022, 1:03 a.m. |
OK |
Java 8 |
TESTS |
47 |
187 |
4608000 |
|
|
161141642 |
MerickBao |
C |
June 19, 2022, 1:09 a.m. |
OK |
Java 8 |
TESTS |
47 |
187 |
4710400 |
|
|
161145239 |
insane_banda |
C |
June 19, 2022, 3:05 a.m. |
OK |
Java 8 |
TESTS |
47 |
187 |
4812800 |
|
|
161119447 |
ardekarsanket |
C |
June 18, 2022, 5:30 p.m. |
OK |
Java 8 |
TESTS |
46 |
202 |
4710400 |
|
|
161123193 |
aryaman_571 |
C |
June 18, 2022, 5:57 p.m. |
OK |
Java 8 |
TESTS |
47 |
202 |
4812800 |
|
|
161122787 |
vaibhav_1710 |
C |
June 18, 2022, 5:53 p.m. |
OK |
Java 8 |
TESTS |
47 |
202 |
4812800 |
|
|
161119950 |
EndlessVoid |
C |
June 18, 2022, 5:33 p.m. |
OK |
Java 8 |
TESTS |
47 |
202 |
5017600 |
|
|
161142953 |
leonlian |
C |
June 19, 2022, 1:57 a.m. |
OK |
Java 8 |
TESTS |
47 |
202 |
5529600 |
|
|
161152475 |
BruteForcee |
C |
June 19, 2022, 5:38 a.m. |
OK |
Kotlin 1.4 |
TESTS |
47 |
217 |
6758400 |
|
|
161120820 |
serg_alb |
C |
June 18, 2022, 5:38 p.m. |
OK |
Kotlin 1.5 |
TESTS |
47 |
826 |
104038400 |
|
|
161122469 |
darkl0rd |
C |
June 18, 2022, 5:50 p.m. |
OK |
Kotlin 1.6 |
TESTS |
47 |
327 |
8806400 |
|
|
161144804 |
wangzheyuyu |
C |
June 19, 2022, 2:53 a.m. |
OK |
MS C++ 2017 |
TESTS |
47 |
483 |
12288000 |
|
|
161136100 |
Bu1izhnik |
C |
June 18, 2022, 9:22 p.m. |
OK |
MS C++ 2017 |
TESTS |
47 |
592 |
8704000 |
|
|
161113821 |
OptimuS99 |
C |
June 18, 2022, 4:28 p.m. |
OK |
MS C++ 2017 |
TESTS |
46 |
623 |
13004800 |
|
|
161121045 |
fatant |
C |
June 18, 2022, 5:39 p.m. |
OK |
MS C++ 2017 |
TESTS |
47 |
624 |
24678400 |
|
|
161119555 |
1_2_3_4_5_9 |
C |
June 18, 2022, 5:30 p.m. |
OK |
PyPy 2 |
TESTS |
46 |
311 |
23244800 |
|
|
161121616 |
hritik3878 |
C |
June 18, 2022, 5:44 p.m. |
OK |
PyPy 3 |
TESTS |
47 |
421 |
44032000 |
|
|
161141341 |
STInverSpinel |
C |
June 19, 2022, 12:57 a.m. |
OK |
PyPy 3 |
TESTS |
47 |
436 |
17100800 |
|
|
161119570 |
abhijeet.panihar.cse20 |
C |
June 18, 2022, 5:31 p.m. |
OK |
PyPy 3 |
TESTS |
46 |
436 |
17920000 |
|
|
161120829 |
Bryce3D |
C |
June 18, 2022, 5:38 p.m. |
OK |
PyPy 3 |
TESTS |
47 |
451 |
18534400 |
|
|
161119787 |
renatxat |
C |
June 18, 2022, 5:32 p.m. |
OK |
PyPy 3 |
TESTS |
47 |
498 |
56012800 |
|
|
161123961 |
sushmanth.dampur8780 |
C |
June 18, 2022, 6:04 p.m. |
OK |
PyPy 3 |
TESTS |
47 |
608 |
44339200 |
|
|
161123515 |
akshitm16 |
C |
June 18, 2022, 6 p.m. |
OK |
PyPy 3 |
TESTS |
47 |
623 |
42905600 |
|
|
161129860 |
Ayushman_123 |
C |
June 18, 2022, 7:15 p.m. |
OK |
PyPy 3 |
TESTS |
47 |
811 |
61132800 |
|
|
161120662 |
ambs_ |
C |
June 18, 2022, 5:37 p.m. |
OK |
PyPy 3 |
TESTS |
47 |
888 |
87347200 |
|
|
161112937 |
shivambhagat02 |
C |
June 18, 2022, 4:27 p.m. |
OK |
PyPy 3 |
TESTS |
46 |
966 |
58777600 |
|
|
161124200 |
wanderman |
C |
June 18, 2022, 6:07 p.m. |
OK |
PyPy 3-64 |
TESTS |
47 |
187 |
16691200 |
|
|
161112613 |
SophieHatter |
C |
June 18, 2022, 4:26 p.m. |
OK |
PyPy 3-64 |
TESTS |
46 |
326 |
54272000 |
|
|
161146259 |
kryptosx |
C |
June 19, 2022, 3:33 a.m. |
OK |
PyPy 3-64 |
TESTS |
47 |
327 |
11161600 |
|
|
161121665 |
Divij12 |
C |
June 18, 2022, 5:44 p.m. |
OK |
PyPy 3-64 |
TESTS |
47 |
343 |
40345600 |
|
|
161121058 |
yoyo_124 |
C |
June 18, 2022, 5:39 p.m. |
OK |
PyPy 3-64 |
TESTS |
47 |
343 |
40345600 |
|
|
161139750 |
biglunchdude |
C |
June 18, 2022, 11:40 p.m. |
OK |
PyPy 3-64 |
TESTS |
47 |
374 |
32153600 |
|
|
161125370 |
ikoma |
C |
June 18, 2022, 6:19 p.m. |
OK |
PyPy 3-64 |
TESTS |
47 |
389 |
26726400 |
|
|
161150198 |
brimstone |
C |
June 19, 2022, 5:01 a.m. |
OK |
PyPy 3-64 |
TESTS |
47 |
389 |
31948800 |
|
|
161119096 |
tryharda |
C |
June 18, 2022, 5:28 p.m. |
OK |
PyPy 3-64 |
TESTS |
46 |
405 |
32972800 |
|
|
161131899 |
deepansh09 |
C |
June 18, 2022, 7:48 p.m. |
OK |
PyPy 3-64 |
TESTS |
47 |
467 |
23859200 |
|
|
161140312 |
AndrescuIII |
C |
June 19, 2022, 12:09 a.m. |
OK |
Python 3 |
TESTS |
47 |
1060 |
146534400 |
|
|
161149934 |
pennymagic156 |
C |
June 19, 2022, 4:56 a.m. |
OK |
Python 3 |
TESTS |
47 |
1341 |
6144000 |
|
|
161119992 |
NS3081992 |
C |
June 18, 2022, 5:33 p.m. |
OK |
Python 3 |
TESTS |
47 |
1387 |
27443200 |
|
|
161131699 |
VioletVal |
C |
June 18, 2022, 7:45 p.m. |
OK |
Python 3 |
TESTS |
47 |
1435 |
27648000 |
|
|
161143111 |
shokal_kishan |
C |
June 19, 2022, 2:03 a.m. |
OK |
Python 3 |
TESTS |
47 |
1482 |
47923200 |
|
|
161129149 |
del-user-774348 |
C |
June 18, 2022, 7:06 p.m. |
OK |
Python 3 |
TESTS |
47 |
1746 |
46489600 |
|
|
161126829 |
chemistry_guy |
C |
June 18, 2022, 6:36 p.m. |
OK |
Python 3 |
TESTS |
47 |
1855 |
48025600 |
|
|
161150470 |
vp2002 |
C |
June 19, 2022, 5:06 a.m. |
OK |
Python 3 |
TESTS |
47 |
1871 |
48537600 |
|
|
161134245 |
Amay12 |
C |
June 18, 2022, 8:38 p.m. |
OK |
Python 3 |
TESTS |
47 |
1871 |
72089600 |
|
|
161145999 |
20020meb1331 |
C |
June 19, 2022, 3:26 a.m. |
OK |
Python 3 |
TESTS |
47 |
1887 |
48435200 |
|
|
161124483 |
robostac |
C |
June 18, 2022, 6:10 p.m. |
OK |
Rust 2021 |
TESTS |
47 |
46 |
4505600 |
|
|
161144419 |
cottoncotton |
C |
June 19, 2022, 2:42 a.m. |
OK |
Rust 2021 |
TESTS |
47 |
62 |
80281600 |
|
|
remove filters
Back to search problems