Task: | Kamen |
Sender: | henrikaalto |
Submission time: | 2019-07-25 16:59:18 +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 | ACCEPTED | 0.01 s | details |
#5 | RUNTIME ERROR | 0.01 s | details |
#6 | RUNTIME ERROR | 0.01 s | details |
#7 | RUNTIME ERROR | 0.01 s | details |
#8 | RUNTIME ERROR | 0.01 s | details |
#9 | RUNTIME ERROR | 0.02 s | details |
#10 | RUNTIME ERROR | 0.02 s | details |
Code
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("arch=sandybridge") #include <bits/stdc++.h> using namespace std; #define all(x) x.begin(), x.end() #define F first #define S second using pi=pair<int,int>; using ii=long long; #define N 30100 #define M 35 char board[N][M]; int n, m; inline int isfree(int y, int x) { if (y >= n || x >= m || y < 0 || x < 0) return 0; return board[y][x] == '.'; } struct segtree { int sz; vector<int> puu; segtree (int n) { int c = 1; while (c * 2 <= n) c*= 2; sz = c; puu.resize(sz * 2 + 1, n-1); } void muuta(int k, int x) { puu[k += sz] = x; for (k/=2;k;k/=2)puu[k]=min(puu[k*2],puu[k*2+1]); } int hae(int a, int b) { int r = N; for (a+=sz,b+=sz;a<=b;a/=2,b/=2) { if (a & 1) r = min(r, puu[a++]); if (~b& 1) r = min(r, puu[b--]); } return r; } }; segtree*asd[M]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> m; for (int j = 0; j < m; ++j) { asd[j] = new segtree(n+1); } for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { char &c = board[i][j]; cin >> c; if (c == 'X') { asd[j]->muuta(i,i); } } } int amt; cin >> amt; for (int i = 0; i < amt; ++i) { int it; cin >> it; int y = 0; int x = it - 1; for (;;) { y = (asd[x]->hae(y, n)) - 1; if (y + 1 >= n) break; else if (board[y + 1][x] == 'O') { if (isfree(y + 1, x - 1) && isfree(y, x - 1)) { x--; y++; } else if (isfree(y, x + 1) && isfree(y + 1, x + 1)) { x++; y++; } else break; } else break; } asd[x]->muuta(y, y); board[y][x] = 'O'; } for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { putchar_unlocked(board[i][j]); } putchar_unlocked('\n'); } }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
5 5
..... ..... ..X.. ..... ... |
correct output |
---|
.....
.OO.. OOX.. OO... OOOO. |
user output |
---|
..... ..O.. ..X.. ..... .O... |
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: ACCEPTED
input |
---|
15 15
............... ............... ............... ............... ... |
correct output |
---|
...............
............... ............... ............... ......O........ ... |
user output |
---|
............... ............... ............... ............... ......O........ ... Truncated |
Test 5
Verdict: RUNTIME ERROR
input |
---|
30 7
....... ....... ......X ....X.. ... |
correct output |
---|
.......
.OOO..O OOOOO.X OOOOX.. OXXXX.. ... |
user output |
---|
(empty) |
Test 6
Verdict: RUNTIME ERROR
input |
---|
30 30
................................. |
correct output |
---|
................................. |
user output |
---|
(empty) |
Test 7
Verdict: RUNTIME ERROR
input |
---|
30000 5
..... ..... ..... ..... ... |
correct output |
---|
.....
..... ..... ..... .O... ... |
user output |
---|
(empty) |
Test 8
Verdict: RUNTIME ERROR
input |
---|
30000 13
............. ............. ...XX...XX... ............. ... |
correct output |
---|
.............
...OO...OO... ...XX...XX... O............ OO...OO...OO. ... |
user output |
---|
(empty) |
Test 9
Verdict: RUNTIME ERROR
input |
---|
30000 21
..................... ..................... ..................... ..................... ... |
correct output |
---|
.....................
..................... ..................... ..................... ..................... ... |
user output |
---|
(empty) |
Test 10
Verdict: RUNTIME ERROR
input |
---|
30000 30
................................. |
correct output |
---|
................................. |
user output |
---|
(empty) |