Task: | Kamen |
Sender: | henrikaalto |
Submission time: | 2019-07-26 16:00:40 +0300 |
Language: | C++ (C++17) |
Status: | READY |
Result: | 0 |
group | verdict | score |
---|---|---|
#1 | WRONG ANSWER | 0 |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.01 s | details |
#2 | WRONG ANSWER | 0.01 s | details |
#3 | WRONG ANSWER | 0.01 s | details |
#4 | WRONG ANSWER | 0.01 s | details |
#5 | WRONG ANSWER | 0.01 s | details |
#6 | WRONG ANSWER | 0.01 s | details |
#7 | WRONG ANSWER | 0.04 s | details |
#8 | WRONG ANSWER | 0.06 s | details |
#9 | WRONG ANSWER | 0.08 s | details |
#10 | WRONG ANSWER | 0.10 s | details |
Code
#include<bits/stdc++.h> using namespace std; using ii=long long; #define all(x) x.begin(), x.end() #define F first #define S second char board[30100][35]; int tt[30100][35]; int n, m; struct aaa { vector<int> joukko; int get_index(int i, int j) { return i * m + j; } int hae(int x) { while (joukko[x] != joukko[joukko[x]]) { joukko[x] = joukko[joukko[x]]; } return joukko[x]; } pair<int,int> decode(int x) { return make_pair(x / m + 1, x % m + 1); } void liita(int y, int x) { x = hae(x); y = hae(y); joukko[y] = x; } aaa() { joukko.resize(n * m); iota(all(joukko), 0); } pair<int,int> hae(int i, int j) { i--; j--; return decode(hae(get_index(i, j))); } // x -> y void liita(int ix, int jx, int iy, int jy) { ix--; jx--; iy--; jy--; liita(get_index(ix, jx), get_index(iy, jy)); } }; int main() { cin >> n >> m; aaa lauta; for (int i = 1; i <= n; ++i) { for (int j = 1; j <= m; ++j) { cin >> board[i][j]; } } for (int i = n; i >= 1; --i) { for (int j = 1; j <= m; ++j) { if (board[i][j] != '.') continue; if (i == n) continue; if (board[i][j] == '.' && board[i + 1][j] == '.') { lauta.liita(i, j, i + 1, j); } } } int amt; cin >> amt; for (int it = 1; it <= amt; ++it) { int x; cin >> x; auto u = lauta.hae(1, x); //cout << "landed @ {"<<u.F<<","<<u.S<<"}\n"; // assert(board[u.F][u.S] == '.'); board[u.F][u.S] = 'O'; if (u.F == 1) continue; u.F--; // assert(board[u.F][u.S] == '.'); if (tt[u.F + 1][u.S] && board[u.F + 1][u.S + 2] == '.') { //cout << "Move jump right\n"; lauta.liita(u.F + 1, u.S, u.F + 1, u.S + 2); } else if (board[u.F][u.S - 1] == '.' && board[u.F + 1][u.S - 1] == '.') { //cout << "Move left\n"; lauta.liita(u.F + 1, u.S, u.F + 1, u.S - 1); tt[u.F + 1][u.S - 1] = 1; } else if (board[u.F][u.S + 1] == '.' && board[u.F + 1][u.S + 1] == '.') { //cout << "Move right\n"; lauta.liita(u.F + 1, u.S, u.F + 1, u.S + 1); } else { //cout << "Move up:(\n"; if (tt[u.F + 1][u.S]) tt[u.F][u.S] = 1; lauta.liita(u.F + 1, u.S, u.F, u.S); } } for (int i = 1; i <= n; ++i) { for (int j = 1; j <= m; ++j) { cout << board[i][j]; } cout << "\n"; } }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
5 5
..... ..... ..X.. ..... ... |
correct output |
---|
.....
.OO.. OOX.. OO... OOOO. |
user output |
---|
..... ..O.. ..X.. ..... OOOOO |
Test 2
Verdict: WRONG ANSWER
input |
---|
6 20
.................... ..........X.X....... X...XX.............X ...XX..........X.... ... |
correct output |
---|
....................
O...O.....X.X......O X..OXX.........O...X ...XX..........X.... ......OO.O....O...O. ... |
user output |
---|
.................... O...O.....X.X......O X..OXX.........O...X ...XX..........X.... ...... ... Truncated |
Test 3
Verdict: WRONG ANSWER
input |
---|
10 10
.......... .......... .XX....X.. .......... ... |
correct output |
---|
..........
.OO....O.. .XX....X.. .......... .....O...O ... |
user output |
---|
.......... .OO....O.. .XX....X.. .......... .....O...O ... Truncated |
Test 4
Verdict: WRONG ANSWER
input |
---|
15 15
............... ............... ............... ............... ... |
correct output |
---|
...............
............... ............... ............... ......O........ ... |
user output |
---|
............... ............... ............... ............... ......O........ ... Truncated |
Test 5
Verdict: WRONG ANSWER
input |
---|
30 7
....... ....... ......X ....X.. ... |
correct output |
---|
.......
.OOO..O OOOOO.X OOOOX.. OXXXX.. ... |
user output |
---|
....... ......O ....O.X .OOOX.. .XXXX.. ... Truncated |
Test 6
Verdict: WRONG ANSWER
input |
---|
30 30
................................. |
correct output |
---|
................................. |
user output |
---|
.............................. ...........O.........O........ ...........X.........X.O...O ... Truncated |
Test 7
Verdict: WRONG ANSWER
input |
---|
30000 5
..... ..... ..... ..... ... |
correct output |
---|
.....
..... ..... ..... .O... ... |
user output |
---|
..... ..... ..... ..... .O... ... Truncated |
Test 8
Verdict: WRONG ANSWER
input |
---|
30000 13
............. ............. ...XX...XX... ............. ... |
correct output |
---|
.............
...OO...OO... ...XX...XX... O............ OO...OO...OO. ... |
user output |
---|
............. ...OO...OO... ...XX...XX... ............. OO...OO...OO. ... Truncated |
Test 9
Verdict: WRONG ANSWER
input |
---|
30000 21
..................... ..................... ..................... ..................... ... |
correct output |
---|
.....................
..................... ..................... ..................... ..................... ... |
user output |
---|
..................... ..................... ..................... ..................... .. ... Truncated |
Test 10
Verdict: WRONG ANSWER
input |
---|
30000 30
................................. |
correct output |
---|
................................. |
user output |
---|
.............................. .............................. ............................ ... Truncated |