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'Your friend Salem is Warawreh 's brother and only loves math and geometry problems. He has solved plenty of such problems, but according to Warawreh, in order to graduate from university he has to solve more graph problems. Since Salem is not good with graphs he asked your help with the following problem. You are given a complete directed graph with n vertices without self-loops. In other words, you have n vertices and each pair of vertices u and v ( u neq v ) has both directed edges (u, v) and (v, u) . Every directed edge of the graph is labeled with a single character: either 'a ' or 'b ' (edges (u, v) and (v, u) may have different labels). You are also given an integer m > 0 . You should find a path of length m such that the string obtained by writing out edges ' labels when going along the path is a palindrome. The length of the path is the number of edges in it. You can visit the same vertex and the same directed edge any number of times. The first line contains a single integer t ( 1 <= t <= 500 ) -- the number of test cases. The first line of each test case contains two integers n and m ( 2 <= q n <= q 1000 ; 1 <= q m <= q 10^{5} ) -- the number of vertices in the graph and desirable length of the palindrome. Each of the next n lines contains n characters. The j -th character of the i -th line describes the character on the edge that is going from node i to node j . Every character is either 'a ' or 'b ' if i neq j , or '* ' if i = j , since the graph doesn 't contain self-loops. It 's guaranteed that the sum of n over test cases doesn 't exceed 1000 and the sum of m doesn 't exceed 10^5 . For each test case, if it is possible to find such path, print "YES" and the path itself as a sequence of m + 1 integers: indices of vertices in the path in the appropriate order. If there are several val'... |
Tutorials
Submissions
Submission Id |
Author(s) |
Index |
Submitted |
Verdict |
Language |
Test Set |
Tests Passed |
Time taken (ms) |
Memory Consumed (bytes) |
Tags |
Rating |
106606280 |
daut-dlang |
D |
Feb. 5, 2021, 4:32 p.m. |
OK |
D |
TESTS |
42 |
61 |
13721600 |
|
|
106627284 |
rainboy |
D |
Feb. 5, 2021, 9:05 p.m. |
OK |
GNU C11 |
TESTS |
42 |
358 |
1024000 |
|
|
106604900 |
rlblaster |
D |
Feb. 5, 2021, 4:29 p.m. |
OK |
GNU C11 |
TESTS |
42 |
358 |
1024000 |
|
|
106639237 |
fishcathu. |
D |
Feb. 6, 2021, 3:51 a.m. |
OK |
GNU C++11 |
TESTS |
42 |
31 |
1024000 |
|
|
106603800 |
fishcathu. |
D |
Feb. 5, 2021, 4:27 p.m. |
OK |
GNU C++11 |
TESTS |
42 |
31 |
1024000 |
|
|
106634162 |
jxm2001_ |
D |
Feb. 6, 2021, 1:28 a.m. |
OK |
GNU C++11 |
TESTS |
42 |
31 |
100352000 |
|
|
106632996 |
clfzs |
D |
Feb. 6, 2021, 12:44 a.m. |
OK |
GNU C++11 |
TESTS |
42 |
31 |
101376000 |
|
|
106633310 |
chen_03 |
D |
Feb. 6, 2021, 12:57 a.m. |
OK |
GNU C++11 |
TESTS |
42 |
46 |
819200 |
|
|
106632045 |
5ab |
D |
Feb. 6, 2021, 12:08 a.m. |
OK |
GNU C++11 |
TESTS |
42 |
46 |
819200 |
|
|
106631087 |
A_zjzj |
D |
Feb. 5, 2021, 11:26 p.m. |
OK |
GNU C++11 |
TESTS |
42 |
46 |
819200 |
|
|
106614271 |
ttsweet |
D |
Feb. 5, 2021, 5:44 p.m. |
OK |
GNU C++11 |
TESTS |
42 |
46 |
819200 |
|
|
106637085 |
vjudge5 |
D |
Feb. 6, 2021, 3:01 a.m. |
OK |
GNU C++11 |
TESTS |
42 |
46 |
819200 |
|
|
106638148 |
Aestas16 |
D |
Feb. 6, 2021, 3:27 a.m. |
OK |
GNU C++11 |
TESTS |
42 |
46 |
819200 |
|
|
106639034 |
Cupids_Bow |
D |
Feb. 6, 2021, 3:48 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
31 |
1024000 |
|
|
106623081 |
debanjan2001 |
D |
Feb. 5, 2021, 7:34 p.m. |
OK |
GNU C++14 |
TESTS |
42 |
46 |
1024000 |
|
|
106621143 |
lakshya492 |
D |
Feb. 5, 2021, 7:05 p.m. |
OK |
GNU C++14 |
TESTS |
42 |
46 |
1024000 |
|
|
106618718 |
4.5Tatami |
D |
Feb. 5, 2021, 6:32 p.m. |
OK |
GNU C++14 |
TESTS |
42 |
46 |
1024000 |
|
|
106617953 |
Raveesh |
D |
Feb. 5, 2021, 6:22 p.m. |
OK |
GNU C++14 |
TESTS |
42 |
46 |
1024000 |
|
|
106617801 |
kkdrummer |
D |
Feb. 5, 2021, 6:21 p.m. |
OK |
GNU C++14 |
TESTS |
42 |
46 |
1024000 |
|
|
106615408 |
Rodp63 |
D |
Feb. 5, 2021, 5:54 p.m. |
OK |
GNU C++14 |
TESTS |
42 |
46 |
1024000 |
|
|
106611743 |
AcWorldDD |
D |
Feb. 5, 2021, 5:25 p.m. |
OK |
GNU C++14 |
TESTS |
42 |
46 |
1024000 |
|
|
106645871 |
chuiniu |
D |
Feb. 6, 2021, 5:51 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
46 |
1024000 |
|
|
106632001 |
zsz12251665 |
D |
Feb. 6, 2021, 12:07 a.m. |
OK |
GNU C++14 |
TESTS |
42 |
46 |
1024000 |
|
|
106611272 |
nechaev |
D |
Feb. 5, 2021, 5:22 p.m. |
OK |
GNU C++17 |
TESTS |
42 |
46 |
0 |
|
|
106644932 |
try_try19 |
D |
Feb. 6, 2021, 5:38 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
46 |
307200 |
|
|
106646739 |
Harris-H |
D |
Feb. 6, 2021, 6:03 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
46 |
1024000 |
|
|
106645577 |
loymyppm |
D |
Feb. 6, 2021, 5:46 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
46 |
1024000 |
|
|
106645535 |
Mondeus |
D |
Feb. 6, 2021, 5:46 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
46 |
1024000 |
|
|
106645467 |
ElaineHuang |
D |
Feb. 6, 2021, 5:45 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
46 |
1024000 |
|
|
106641676 |
ricar0 |
D |
Feb. 6, 2021, 4:43 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
46 |
1024000 |
|
|
106641518 |
Hp_32 |
D |
Feb. 6, 2021, 4:40 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
46 |
1024000 |
|
|
106645991 |
Hien |
D |
Feb. 6, 2021, 5:52 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
46 |
1024000 |
|
|
106646058 |
tudouuuuu |
D |
Feb. 6, 2021, 5:53 a.m. |
OK |
GNU C++17 |
TESTS |
42 |
46 |
1024000 |
|
|
106613421 |
Wa-Automaton |
D |
Feb. 5, 2021, 5:37 p.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
31 |
1024000 |
|
|
106611485 |
albertxwz |
D |
Feb. 5, 2021, 5:23 p.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
31 |
1024000 |
|
|
106615242 |
not_slacker |
D |
Feb. 5, 2021, 5:53 p.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
31 |
1843200 |
|
|
106616255 |
Thallium54 |
D |
Feb. 5, 2021, 6:03 p.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
31 |
1945600 |
|
|
106646661 |
loenvom |
D |
Feb. 6, 2021, 6:01 a.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
31 |
2150400 |
|
|
106632349 |
Sakuyalove |
D |
Feb. 6, 2021, 12:19 a.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
31 |
4300800 |
|
|
106616961 |
Farhan132 |
D |
Feb. 5, 2021, 6:10 p.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
46 |
0 |
|
|
106605973 |
HuaShanLunJian |
D |
Feb. 5, 2021, 4:31 p.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
46 |
921600 |
|
|
106639289 |
Terryjoy |
D |
Feb. 6, 2021, 3:53 a.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
46 |
1024000 |
|
|
106643116 |
DanielMontes |
D |
Feb. 6, 2021, 5:11 a.m. |
OK |
GNU C++17 (64) |
TESTS |
42 |
46 |
1024000 |
|
|
106614127 |
keemzen |
D |
Feb. 5, 2021, 5:42 p.m. |
OK |
Go |
TESTS |
42 |
77 |
102400 |
|
|
106623287 |
clyring |
D |
Feb. 5, 2021, 7:37 p.m. |
OK |
Haskell |
TESTS |
42 |
61 |
1228800 |
|
|
106640604 |
_merlin_ |
D |
Feb. 6, 2021, 4:21 a.m. |
OK |
Java 11 |
TESTS |
42 |
218 |
102400 |
|
|
106613776 |
insert_cool_handle |
D |
Feb. 5, 2021, 5:39 p.m. |
OK |
Java 11 |
TESTS |
42 |
233 |
0 |
|
|
106611301 |
mennafadali |
D |
Feb. 5, 2021, 5:22 p.m. |
OK |
Java 11 |
TESTS |
42 |
233 |
0 |
|
|
106610718 |
mennafadali |
D |
Feb. 5, 2021, 5:19 p.m. |
OK |
Java 11 |
TESTS |
42 |
233 |
0 |
|
|
106615455 |
RuthlessAggression |
D |
Feb. 5, 2021, 5:55 p.m. |
OK |
Java 11 |
TESTS |
42 |
249 |
716800 |
|
|
106621315 |
Future_Googley |
D |
Feb. 5, 2021, 7:07 p.m. |
OK |
Java 11 |
TESTS |
42 |
265 |
102400 |
|
|
106621817 |
harshitContest |
D |
Feb. 5, 2021, 7:15 p.m. |
OK |
Java 8 |
TESTS |
42 |
140 |
0 |
|
|
106614832 |
SlowLegendaryNoobMaster |
D |
Feb. 5, 2021, 5:49 p.m. |
OK |
Java 8 |
TESTS |
42 |
140 |
0 |
|
|
106608538 |
edenSpace |
D |
Feb. 5, 2021, 4:34 p.m. |
OK |
Java 8 |
TESTS |
42 |
140 |
0 |
|
|
106625984 |
Abdallah_Ragab00 |
D |
Feb. 5, 2021, 8:29 p.m. |
OK |
Java 8 |
TESTS |
42 |
155 |
0 |
|
|
106617480 |
ansrespls |
D |
Feb. 5, 2021, 6:17 p.m. |
OK |
Java 8 |
TESTS |
42 |
155 |
0 |
|
|
106617088 |
gchai18 |
D |
Feb. 5, 2021, 6:12 p.m. |
OK |
Java 8 |
TESTS |
42 |
155 |
0 |
|
|
106606451 |
ManchesterCityFC |
D |
Feb. 5, 2021, 4:32 p.m. |
OK |
Java 8 |
TESTS |
42 |
155 |
0 |
|
|
106620680 |
InANutshell |
D |
Feb. 5, 2021, 6:59 p.m. |
OK |
Java 8 |
TESTS |
42 |
156 |
0 |
|
|
106612305 |
shojin_pro |
D |
Feb. 5, 2021, 5:28 p.m. |
OK |
Java 8 |
TESTS |
42 |
171 |
0 |
|
|
106628390 |
liuy0523 |
D |
Feb. 5, 2021, 9:42 p.m. |
OK |
Java 8 |
TESTS |
42 |
218 |
5836800 |
|
|
106639576 |
Spheniscine |
D |
Feb. 6, 2021, 3:59 a.m. |
OK |
Kotlin |
TESTS |
42 |
155 |
1228800 |
|
|
106607421 |
koboshi |
D |
Feb. 5, 2021, 4:34 p.m. |
OK |
Kotlin |
TESTS |
42 |
202 |
409600 |
|
|
106621649 |
arvindf232 |
D |
Feb. 5, 2021, 7:12 p.m. |
OK |
Kotlin |
TESTS |
42 |
218 |
14745600 |
|
|
106626122 |
Scotty_pwnz |
D |
Feb. 5, 2021, 8:32 p.m. |
OK |
Kotlin |
TESTS |
42 |
233 |
5529600 |
|
|
106626072 |
koper |
D |
Feb. 5, 2021, 8:30 p.m. |
OK |
Kotlin |
TESTS |
42 |
249 |
1843200 |
|
|
106614517 |
kekxy |
D |
Feb. 5, 2021, 5:46 p.m. |
OK |
MS C++ 2017 |
TESTS |
42 |
46 |
1331200 |
|
|
106607130 |
WisdomP |
D |
Feb. 5, 2021, 4:33 p.m. |
OK |
MS C++ 2017 |
TESTS |
42 |
46 |
1331200 |
|
|
106605019 |
Cube219 |
D |
Feb. 5, 2021, 4:30 p.m. |
OK |
MS C++ 2017 |
TESTS |
42 |
78 |
1024000 |
|
|
106610916 |
Gravekper |
D |
Feb. 5, 2021, 5:20 p.m. |
OK |
MS C++ 2017 |
TESTS |
42 |
93 |
1433600 |
|
|
106606664 |
jonitox |
D |
Feb. 5, 2021, 4:33 p.m. |
OK |
MS C++ 2017 |
TESTS |
42 |
218 |
1433600 |
|
|
106625135 |
rsFalse |
D |
Feb. 5, 2021, 8:10 p.m. |
OK |
Perl |
TESTS |
42 |
529 |
75468800 |
|
|
106617559 |
rsFalse |
D |
Feb. 5, 2021, 6:18 p.m. |
OK |
Perl |
TESTS |
42 |
561 |
75980800 |
|
|
106624326 |
Marshmello |
D |
Feb. 5, 2021, 7:54 p.m. |
OK |
PyPy 2 |
TESTS |
42 |
124 |
7065600 |
|
|
106626750 |
kagu |
D |
Feb. 5, 2021, 8:49 p.m. |
OK |
PyPy 2 |
TESTS |
42 |
124 |
8908800 |
|
|
106605590 |
diprox.jain |
D |
Feb. 5, 2021, 4:31 p.m. |
OK |
PyPy 2 |
TESTS |
42 |
1075 |
22835200 |
|
|
106613447 |
yinuowang |
D |
Feb. 5, 2021, 5:37 p.m. |
OK |
PyPy 3 |
TESTS |
42 |
140 |
12390400 |
|
|
106613756 |
aberent |
D |
Feb. 5, 2021, 5:39 p.m. |
OK |
PyPy 3 |
TESTS |
42 |
186 |
4198400 |
|
|
106612998 |
at_f |
D |
Feb. 5, 2021, 5:33 p.m. |
OK |
PyPy 3 |
TESTS |
42 |
186 |
14233600 |
|
|
106628573 |
montreal |
D |
Feb. 5, 2021, 9:48 p.m. |
OK |
PyPy 3 |
TESTS |
42 |
218 |
9318400 |
|
|
106621123 |
Garrus |
D |
Feb. 5, 2021, 7:05 p.m. |
OK |
PyPy 3 |
TESTS |
42 |
218 |
12083200 |
|
|
106624483 |
awoo |
D |
Feb. 5, 2021, 7:57 p.m. |
OK |
PyPy 3 |
TESTS |
42 |
233 |
10547200 |
|
|
106628206 |
silvertint |
D |
Feb. 5, 2021, 9:35 p.m. |
OK |
PyPy 3 |
TESTS |
42 |
233 |
11776000 |
|
|
106605423 |
myotra |
D |
Feb. 5, 2021, 4:30 p.m. |
OK |
PyPy 3 |
TESTS |
42 |
233 |
12492800 |
|
|
106629810 |
david-mm |
D |
Feb. 5, 2021, 10:32 p.m. |
OK |
PyPy 3 |
TESTS |
42 |
233 |
13107200 |
|
|
106627581 |
Zack |
D |
Feb. 5, 2021, 9:15 p.m. |
OK |
PyPy 3 |
TESTS |
42 |
234 |
10240000 |
|
|
106626767 |
rpfl |
D |
Feb. 5, 2021, 8:49 p.m. |
OK |
Python 3 |
TESTS |
42 |
218 |
3481600 |
|
|
106622501 |
zheland |
D |
Feb. 5, 2021, 7:25 p.m. |
OK |
Rust |
TESTS |
42 |
46 |
1024000 |
|
|
remove filters
Back to search problems