CSES - COCI 2006/2007 #6 - Results
Submission details
Task:Kamen
Sender:henrikaalto
Submission time:2019-07-27 20:11:55 +0300
Language:C++ (C++17)
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.01 sdetails
#20.01 sdetails
#30.01 sdetails
#40.01 sdetails
#50.01 sdetails
#60.01 sdetails
#70.04 sdetails
#80.07 sdetails
#90.09 sdetails
#100.11 sdetails

Code

#include <bits/stdc++.h>
using namespace std;

struct pos {
    int y, x;
    pos(int Y, int X)
    {
        y = Y;
        x = X;
    }
};

#define N 30100
#define M 35

char board[N][M];
vector<pos> path[M];
int n, m;

int empty(int y, int x)
{
    return board[y][x] == '.';
}

void gen(int y, int x, vector<pos> &vec)
{
    vec.push_back(pos(y, x));
    if (y == n || board[y + 1][x] == 'X') {
        return ;
    }
    if (empty(y + 1, x)) {
        gen(y + 1, x, vec);
    }
    else {
        if (empty(y, x - 1) && empty(y + 1, x - 1)) {
            gen(y + 1, x - 1, vec);
        }
        else if (empty(y, x + 1) && empty(y + 1, x + 1)) {
            gen(y + 1, x + 1, vec);
        }
    }
}

int main()
{
    cin >> n >> m;
    for (int i = 1; i <= n; ++i) {
        for (int j = 1; j <= m; ++j) {
            cin >> board[i][j];
        }
    }
    for (int j = 1; j <= m; ++j) {
        gen(1, j, path[j]);
    }
    int amt;
    cin >> amt;
    for (int it = 1; it <= amt; ++it) {
        int x;
        cin >> x;
        pos k = path[x].back();
        board[k.y][k.x] = 'O';
        path[x].pop_back();
        k = path[x].back();
        path[x].pop_back();
        gen(k.y, k.x, path[x]);
    }
    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: ACCEPTED

input
5 5
.....
.....
..X..
.....
...

correct output
.....
.OO..
OOX..
OO...
OOOO.

user output
.....
.OO..
OOX..
OO...
OOOO.

Test 2

Verdict:

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:

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:

input
15 15
...............
...............
...............
...............
...

correct output
...............
...............
...............
...............
......O........
...

user output
...............
...............
...............
...............
......O........
...
Truncated

Test 5

Verdict:

input
30 7
.......
.......
......X
....X..
...

correct output
.......
.OOO..O
OOOOO.X
OOOOX..
OXXXX..
...

user output
.......
...O..O
..OOO.X
.OOOX..
.XXXX..
...
Truncated

Test 6

Verdict:

input
30 30
.................................

correct output
.................................

user output
..............................
...........O.........O........
...........X.........X.O...O

...
Truncated

Test 7

Verdict:

input
30000 5
.....
.....
.....
.....
...

correct output
.....
.....
.....
.....
.O...
...

user output
.....
.....
.....
.....
.O...
...
Truncated

Test 8

Verdict:

input
30000 13
.............
.............
...XX...XX...
.............
...

correct output
.............
...OO...OO...
...XX...XX...
O............
OO...OO...OO.
...

user output
.............
...OO...OO...
...XX...XX...
O............
OO...OO...OO.
...
Truncated

Test 9

Verdict:

input
30000 21
.....................
.....................
.....................
.....................
...

correct output
.....................
.....................
.....................
.....................
.....................
...

user output
.....................
.....................
.....................
.....................
..
...
Truncated

Test 10

Verdict:

input
30000 30
.................................

correct output
.................................

user output
..............................
..............................
............................

...
Truncated