답안 #867639

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
867639 2023-10-29T03:53:37 Z cheat_when_I_was_young Tracks in the Snow (BOI13_tracks) C++17
0 / 100
962 ms 1048576 KB
#include "bits/stdc++.h"
using namespace std;
void solve();
bool multitest();
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    clock_t TIME = clock();
    int TEST = 1;
    if (multitest()) cin >> TEST;
    while (TEST--) solve();
    cerr << "\nUsed: " << clock() - TIME << " ms\n\n";
}

bool multitest() {
    return 0;
}

int n, m;
char a[4005][4005];
bool visited[4005][4005], F, R;

void dfs(int x, int y) {
    if (a[x][y] == 'F') F = 1;
    if (a[x][y] == 'R') R = 1;
    visited[x][y] = 1;

    for (int i = max(x-1, 1); i <= min(x+1, n); ++i)
        for (int j = max(y-1, 1); j <= min(y+1, m); ++j)
            if ((i != x || j != y) && a[i][j] != '.' && !visited[i][j])
                dfs(i, j);
}

void solve() {
    cin >> n >> m;
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= m; ++j)
            cin >> a[i][j];

    int ans = 0;

    for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= m; ++j)
            if (a[i][j] != '.' && !visited[i][j]) {
                F = R = 0;
                dfs(i, j);
                ans += F + R;
            }

    cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 22 ms 28508 KB Output isn't correct
2 Incorrect 1 ms 2396 KB Output isn't correct
3 Incorrect 1 ms 2652 KB Output isn't correct
4 Incorrect 15 ms 20828 KB Output isn't correct
5 Incorrect 4 ms 7004 KB Output isn't correct
6 Incorrect 1 ms 2396 KB Output isn't correct
7 Incorrect 1 ms 2652 KB Output isn't correct
8 Incorrect 1 ms 3160 KB Output isn't correct
9 Incorrect 1 ms 2904 KB Output isn't correct
10 Incorrect 3 ms 7004 KB Output isn't correct
11 Incorrect 4 ms 6996 KB Output isn't correct
12 Incorrect 9 ms 13404 KB Output isn't correct
13 Incorrect 4 ms 7004 KB Output isn't correct
14 Incorrect 4 ms 7004 KB Output isn't correct
15 Incorrect 16 ms 21184 KB Output isn't correct
16 Incorrect 22 ms 28612 KB Output isn't correct
17 Incorrect 13 ms 15196 KB Output isn't correct
18 Incorrect 16 ms 20828 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 32604 KB Output isn't correct
2 Incorrect 56 ms 52796 KB Output isn't correct
3 Incorrect 381 ms 300696 KB Output isn't correct
4 Incorrect 89 ms 58196 KB Output isn't correct
5 Incorrect 448 ms 453588 KB Output isn't correct
6 Runtime error 745 ms 1048576 KB Execution killed with signal 9
7 Incorrect 9 ms 32608 KB Output isn't correct
8 Incorrect 10 ms 32604 KB Output isn't correct
9 Incorrect 3 ms 4700 KB Output isn't correct
10 Incorrect 1 ms 2908 KB Output isn't correct
11 Incorrect 9 ms 31836 KB Output isn't correct
12 Incorrect 2 ms 4056 KB Output isn't correct
13 Incorrect 57 ms 53412 KB Output isn't correct
14 Incorrect 35 ms 33628 KB Output isn't correct
15 Incorrect 35 ms 38236 KB Output isn't correct
16 Incorrect 29 ms 31068 KB Output isn't correct
17 Incorrect 141 ms 121424 KB Output isn't correct
18 Incorrect 140 ms 125264 KB Output isn't correct
19 Incorrect 92 ms 59196 KB Output isn't correct
20 Incorrect 97 ms 77140 KB Output isn't correct
21 Incorrect 233 ms 186220 KB Output isn't correct
22 Incorrect 438 ms 456024 KB Output isn't correct
23 Incorrect 271 ms 231188 KB Output isn't correct
24 Incorrect 343 ms 315472 KB Output isn't correct
25 Incorrect 584 ms 471888 KB Output isn't correct
26 Runtime error 684 ms 1048576 KB Execution killed with signal 9
27 Runtime error 721 ms 1048576 KB Execution killed with signal 9
28 Runtime error 742 ms 1048576 KB Execution killed with signal 9
29 Runtime error 734 ms 1048576 KB Execution killed with signal 9
30 Runtime error 715 ms 1048576 KB Execution killed with signal 9
31 Incorrect 962 ms 993484 KB Output isn't correct
32 Runtime error 734 ms 1048576 KB Execution killed with signal 9