Submission #333341

# Submission time Handle Problem Language Result Execution time Memory
333341 2020-12-05T16:30:52 Z luanaamorim Tracks in the Snow (BOI13_tracks) C++14
2.1875 / 100
2000 ms 31852 KB
#include <iostream>
#include <queue>

using namespace std;

char tab[4000][4000];
int n, m, f, r, ans;
queue<pair<int, int> > fila;

int main()
{
    cin >> n >> m;
    for (int i = 0; i < n; i++) 
        for (int j = 0; j < m; j++)
            cin >> tab[i][j];

    for (int i = 0; i < n; i++) 
        for (int j = 0; j < m; j++)
        {
            if (tab[i][j] != '.')
            { 
                f = 0, r = 0;
                fila.push(make_pair(i, j));
                while (!fila.empty())
                {   
                    int a = fila.front().first, b = fila.front().second; fila.pop();
                    if (a < 0 || b < 0 || a > n - 1 || b > m - 1) continue;
                    if (tab[a][b] == '.') continue;
                    else if (tab[a][b] == 'R') r = 1;
                    else f = 1;
                    tab[a][b] = '.';
                    fila.push(make_pair(a + 1, b));
                    fila.push(make_pair(a - 1, b));
                    fila.push(make_pair(a, b + 1));
                    fila.push(make_pair(a, b - 1));
                }
                ans += f + r;
            }
        }

    cout << ans << endl;
}
# Verdict Execution time Memory Grader output
1 Incorrect 30 ms 2540 KB Output isn't correct
2 Incorrect 1 ms 364 KB Output isn't correct
3 Incorrect 1 ms 492 KB Output isn't correct
4 Incorrect 19 ms 2412 KB Output isn't correct
5 Incorrect 7 ms 1516 KB Output isn't correct
6 Incorrect 1 ms 364 KB Output isn't correct
7 Incorrect 1 ms 492 KB Output isn't correct
8 Incorrect 1 ms 620 KB Output isn't correct
9 Incorrect 1 ms 748 KB Output isn't correct
10 Incorrect 6 ms 1388 KB Output isn't correct
11 Incorrect 5 ms 1132 KB Output isn't correct
12 Incorrect 11 ms 1516 KB Output isn't correct
13 Incorrect 8 ms 1516 KB Output isn't correct
14 Incorrect 8 ms 1516 KB Output isn't correct
15 Incorrect 27 ms 2540 KB Output isn't correct
16 Incorrect 29 ms 2540 KB Output isn't correct
17 Incorrect 23 ms 2432 KB Output isn't correct
18 Incorrect 19 ms 2412 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 15340 KB Output isn't correct
2 Incorrect 140 ms 7076 KB Output isn't correct
3 Incorrect 1175 ms 31592 KB Output isn't correct
4 Incorrect 274 ms 11372 KB Output isn't correct
5 Incorrect 762 ms 20972 KB Output isn't correct
6 Execution timed out 2088 ms 31792 KB Time limit exceeded
7 Incorrect 13 ms 15980 KB Output isn't correct
8 Incorrect 13 ms 15340 KB Output isn't correct
9 Incorrect 6 ms 492 KB Output isn't correct
10 Incorrect 3 ms 364 KB Output isn't correct
11 Incorrect 12 ms 15724 KB Output isn't correct
12 Incorrect 3 ms 876 KB Output isn't correct
13 Incorrect 135 ms 6724 KB Output isn't correct
14 Incorrect 91 ms 4844 KB Output isn't correct
15 Incorrect 80 ms 5228 KB Output isn't correct
16 Incorrect 60 ms 2540 KB Output isn't correct
17 Incorrect 346 ms 12268 KB Output isn't correct
18 Incorrect 322 ms 12012 KB Output isn't correct
19 Incorrect 269 ms 11500 KB Output isn't correct
20 Incorrect 259 ms 10604 KB Output isn't correct
21 Incorrect 689 ms 21612 KB Output isn't correct
22 Incorrect 768 ms 20972 KB Output isn't correct
23 Incorrect 662 ms 17644 KB Output isn't correct
24 Incorrect 717 ms 21484 KB Output isn't correct
25 Incorrect 1317 ms 31820 KB Output isn't correct
26 Correct 1633 ms 26220 KB Output is correct
27 Execution timed out 2088 ms 31852 KB Time limit exceeded
28 Execution timed out 2088 ms 31852 KB Time limit exceeded
29 Execution timed out 2093 ms 31724 KB Time limit exceeded
30 Execution timed out 2089 ms 31084 KB Time limit exceeded
31 Incorrect 1353 ms 23276 KB Output isn't correct
32 Incorrect 1919 ms 31796 KB Output isn't correct