Masala #0826

Xotira 16 MB Vaqt 1000 ms Qiyinchiligi 35 %
14

  

Shaxmat donalarini surish #2

Shaxmat o'ynashni bilmaydigan dasturchi bo'lmasa kerak. Ko'pchilik yaxshi o'ynay olmasa ham qaysi dona qayerdan qayerga yura olishini yaxshi biladi. Hozirgi vazifani bajarish uchun esa hech bo'lmaganda shuni bilishingiz zarur. Sizga shaxmat donalaridan birining nomi (Shoh, Farzin, Fil, Ot, Ruh) va uning shaxmat doskasidagi koordinatalari \(\text{(A1, A2, ..., H8)}\) beriladi. Siz shaxmat taxtasidagi quyidagi holatni \(\text{array[8,8]}\) matritsada tasvirlab berishingiz kerak.
\(\text{A1}\) katak matritsaning chap quyi burchagi, ya'ni \(\text{array[7,0]}\) deb qaraladi.

Matritsani quyidagicha to'ldiring:

  • Shaxmat donasi turgan katakni 2 bilan;
  • U yura oladigan kataklarni 1 bilan;
  • Qolgan barcha kataklarni 0 bilan to'ldiring.

Kiruvchi ma'lumotlar:

Bir satrda biror shaxmat donasining nomi (Piyodadan boshqa) va uning shaxmat taxtasidagi koordinatasi probel bilan ajratilgan holda beriladi.


Chiquvchi ma'lumotlar:

Masalaning yechimi


Misollar
# input.txt output.txt
1
Shoh F5
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 1 1 1 0
0 0 0 0 1 2 1 0
0 0 0 0 1 1 1 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
2
Ruh H1
0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 1
1 1 1 1 1 1 1 2
3
Farzin C3
0 0 1 0 0 0 0 1
0 0 1 0 0 0 1 0
0 0 1 0 0 1 0 0
1 0 1 0 1 0 0 0
0 1 1 1 0 0 0 0
1 1 2 1 1 1 1 1
0 1 1 1 0 0 0 0
1 0 1 0 1 0 0 0
4
Fil A1
0 0 0 0 0 0 0 1
0 0 0 0 0 0 1 0
0 0 0 0 0 1 0 0
0 0 0 0 1 0 0 0
0 0 0 1 0 0 0 0
0 0 1 0 0 0 0 0
0 1 0 0 0 0 0 0
2 0 0 0 0 0 0 0
5
Ot D4
0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0
0 0 1 0 1 0 0 0
0 1 0 0 0 1 0 0
0 0 0 2 0 0 0 0
0 1 0 0 0 1 0 0
0 0 1 0 1 0 0 0
0 0 0 0 0 0 0 0
Izoh:

1 - test:

Yechimini yuborish
Bu amalni bajarish uchun tizimga kiring, agar profilingiz bo'lmasa istalgan payt ro'yxatdan o'tishingiz mumkin