CSES - COCI 2006/2007 #6 - Results
Submission details
Task:Kamen
Sender:henrikaalto
Submission time:2019-07-25 16:45:05 +0300
Language:C++ (C++17)
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#1ACCEPTED0.01 sdetails
#2ACCEPTED0.01 sdetails
#3ACCEPTED0.01 sdetails
#4ACCEPTED0.01 sdetails
#5ACCEPTED0.01 sdetails
#6ACCEPTED0.01 sdetails
#7--details
#8--details
#9--details
#10--details

Code

#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

// set<pair<int,int>> asd[M];

char board[N][M];

int asd[N][M];


int n, m;
inline int isfree(int y, int x)
{
    if (y >= n || x >= m || y < 0 || x < 0) return 0;
    return asd[y][x] == 0;
}

int main()
{
    cin >> n >> m;
    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[i][j] = 1; ///{i, 1};
                // asd[j].emplace(n - i, 0);
            }
        }
    } 
    int amt;
    cin >> amt;
    for (int i = 0; i < amt; ++i) {
        int it;
        cin >> it;
        int y = 0;
        int x = it - 1;
        for (;;)
        {
            for (; y + 1 < n && !asd[y + 1][x]; ++y);
            if (y + 1 == n) break;
            else if (asd[y + 1][x] == 2) {
                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[y][x] = 2;
        board[y][x] = 'O';
    }
    for (int i = 0; i < n; ++i) {
        for (int j = 0; 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: ACCEPTED

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: ACCEPTED

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: ACCEPTED

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

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

user output
.......
.OOO..O
OOOOO.X
OOOOX..
OXXXX..
...
Truncated

Test 6

Verdict: ACCEPTED

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
(empty)

Test 8

Verdict:

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

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

user output
(empty)

Test 9

Verdict:

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

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

user output
(empty)

Test 10

Verdict:

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

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

user output
(empty)