답안 #333517

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
333517 2020-12-06T19:14:12 Z luanaamorim Tracks in the Snow (BOI13_tracks) C++14
2.1875 / 100
2000 ms 83648 KB
#include <iostream>
#include <queue>

using namespace std;

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

void bfs(int a, int b)
{
    fila.push(make_pair(a, b));
    while (!fila.empty())
    {   
        int a = fila.front().first, b = fila.front().second; fila.pop();
        if (a < 1 || b < 1 || a > n || b > m) continue;
        if (tab[a][b] == '.' || passou[a][b]) continue;
        r += (tab[a][b] == 'R'), f += (tab[a][b] == 'F');
        passou[a][b] = 1;
        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));
    }
}

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

    bfs(1, 1);
    r = min(r, 1), f = min(f, 1);

    cout << r + f << endl;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 31 ms 5356 KB Output isn't correct
2 Incorrect 0 ms 492 KB Output isn't correct
3 Incorrect 1 ms 768 KB Output isn't correct
4 Incorrect 21 ms 4984 KB Output isn't correct
5 Incorrect 8 ms 2924 KB Output isn't correct
6 Incorrect 1 ms 512 KB Output isn't correct
7 Incorrect 1 ms 748 KB Output isn't correct
8 Incorrect 1 ms 876 KB Output isn't correct
9 Incorrect 2 ms 1144 KB Output isn't correct
10 Incorrect 7 ms 2540 KB Output isn't correct
11 Incorrect 6 ms 2156 KB Output isn't correct
12 Incorrect 12 ms 3052 KB Output isn't correct
13 Incorrect 8 ms 2944 KB Output isn't correct
14 Incorrect 8 ms 2924 KB Output isn't correct
15 Incorrect 35 ms 5356 KB Output isn't correct
16 Incorrect 32 ms 5356 KB Output isn't correct
17 Incorrect 25 ms 5228 KB Output isn't correct
18 Incorrect 21 ms 4972 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 23 ms 30828 KB Output isn't correct
2 Incorrect 143 ms 15084 KB Output isn't correct
3 Incorrect 1148 ms 62956 KB Output isn't correct
4 Incorrect 298 ms 32236 KB Output isn't correct
5 Incorrect 769 ms 49856 KB Output isn't correct
6 Execution timed out 2027 ms 76636 KB Time limit exceeded
7 Incorrect 23 ms 32236 KB Output isn't correct
8 Incorrect 23 ms 30828 KB Output isn't correct
9 Incorrect 6 ms 620 KB Output isn't correct
10 Incorrect 3 ms 492 KB Output isn't correct
11 Incorrect 22 ms 31596 KB Output isn't correct
12 Incorrect 3 ms 1644 KB Output isn't correct
13 Incorrect 144 ms 15084 KB Output isn't correct
14 Incorrect 83 ms 10476 KB Output isn't correct
15 Incorrect 88 ms 13164 KB Output isn't correct
16 Incorrect 63 ms 5740 KB Output isn't correct
17 Incorrect 371 ms 28492 KB Output isn't correct
18 Incorrect 343 ms 35180 KB Output isn't correct
19 Incorrect 300 ms 32256 KB Output isn't correct
20 Incorrect 260 ms 25068 KB Output isn't correct
21 Incorrect 679 ms 48620 KB Output isn't correct
22 Incorrect 764 ms 50028 KB Output isn't correct
23 Incorrect 729 ms 41452 KB Output isn't correct
24 Incorrect 701 ms 46316 KB Output isn't correct
25 Incorrect 1445 ms 83648 KB Output isn't correct
26 Correct 1837 ms 74020 KB Output is correct
27 Execution timed out 2104 ms 79084 KB Time limit exceeded
28 Execution timed out 2096 ms 78060 KB Time limit exceeded
29 Execution timed out 2104 ms 78188 KB Time limit exceeded
30 Execution timed out 2098 ms 78360 KB Time limit exceeded
31 Incorrect 1527 ms 68616 KB Output isn't correct
32 Execution timed out 2077 ms 83348 KB Time limit exceeded