GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Friday 2 September 2022

[Solution] Madoka and Underground Competitions Codeforces Solution



B. Madoka and Underground Competitions
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Madoka decided to participate in an underground sports programming competition. And there was exactly one task in it:

A square table of size n×n, where n is a multiple of k, is called good if only the characters '.' and 'X' are written in it, as well as in any subtable of size 1×k or k×1, there is at least one character 'X'. In other words, among any k consecutive vertical or horizontal cells, there must be at least one containing the character 'X'.

Output any good table that has the minimum possible number of characters 'X', and also the symbol 'X' is written in the cell (r,c). Rows are numbered from 1 to n from top to bottom, columns are

Solution Click Below:-  👉CLICK HERE👈
👇👇👇👇👇

 numbered from 1 to n from left to right.

Input

The input consists of multiple test cases. The first line contains a single integer t (1t100) — the number of test cases. Description of the test cases follows.

The first and the only line of each test case contains four integers nkrc (1n500,1kn,1r,cn) — the size of the table, the integer k and the coordinates of the cell, which must contain the character 'X'. It is guaranteed that n is a multiple of k.

It is guaranteed that the sum of n over all test cases does not exceed 500.

Output

For each test case, output n lines, each consisting of n characters '.' and 'X', — the desired table. If there are several answers, then you can output anyone.



No comments:

Post a Comment