Submission #954579

# Submission time Handle Problem Language Result Execution time Memory
954579 2024-03-28T07:29:39 Z ezzzay Tracks in the Snow (BOI13_tracks) C++14
9.89583 / 100
2000 ms 48036 KB
#include<bits/stdc++.h>
using namespace std;
const int N=4e3+1;
char a[N][N];
int xx[2]={0,1};
int yy[2]={1,0};
bool vis[N][N];
void dfs(int py, int px, char c){
    a[py][px]='?';
    vis[py][px]=1;
    for(int i=0;i<2;i++){
        if((a[py+yy[i]][px+xx[i]]=='?' or a[py+yy[i]][px+xx[i]]==c) and vis[py+yy[i]][px+xx[i]]==0){
    
            dfs(py+yy[i],px+xx[i],c);
        }
    }
}
signed main(){
    int n,m;
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cin>>a[i][j];
        }
    }
    int cnt=0;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(a[i][j]=='F' or a[i][j]=='R'){
                for(int x=1;x<=n;x++){
                    for(int y=1;y<=m;y++)vis[x][y]=0;
                }
                dfs(i,j,a[i][j]);
                cnt++;
                i=1;
                j=1;
            }
        }
    }
    cout<<cnt;
}
# Verdict Execution time Memory Grader output
1 Incorrect 621 ms 7060 KB Output isn't correct
2 Correct 2 ms 2392 KB Output is correct
3 Incorrect 1 ms 4700 KB Output isn't correct
4 Incorrect 96 ms 6968 KB Output isn't correct
5 Incorrect 211 ms 7004 KB Output isn't correct
6 Correct 1 ms 2408 KB Output is correct
7 Incorrect 2 ms 4704 KB Output isn't correct
8 Incorrect 2 ms 4704 KB Output isn't correct
9 Incorrect 5 ms 4764 KB Output isn't correct
10 Incorrect 181 ms 6756 KB Output isn't correct
11 Incorrect 9 ms 4704 KB Output isn't correct
12 Incorrect 137 ms 6904 KB Output isn't correct
13 Incorrect 223 ms 6888 KB Output isn't correct
14 Incorrect 203 ms 6756 KB Output isn't correct
15 Incorrect 1354 ms 7076 KB Output isn't correct
16 Incorrect 616 ms 7068 KB Output isn't correct
17 Incorrect 1703 ms 7084 KB Output isn't correct
18 Incorrect 92 ms 6960 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 362 ms 31732 KB Output isn't correct
2 Execution timed out 2067 ms 14420 KB Time limit exceeded
3 Execution timed out 2060 ms 47776 KB Time limit exceeded
4 Execution timed out 2037 ms 22816 KB Time limit exceeded
5 Execution timed out 2004 ms 36432 KB Time limit exceeded
6 Execution timed out 2013 ms 48036 KB Time limit exceeded
7 Incorrect 270 ms 32088 KB Output isn't correct
8 Incorrect 358 ms 31728 KB Output isn't correct
9 Incorrect 107 ms 2908 KB Output isn't correct
10 Correct 41 ms 2652 KB Output is correct
11 Incorrect 145 ms 31792 KB Output isn't correct
12 Correct 134 ms 4748 KB Output is correct
13 Execution timed out 2045 ms 14424 KB Time limit exceeded
14 Execution timed out 2061 ms 11820 KB Time limit exceeded
15 Execution timed out 2037 ms 11820 KB Time limit exceeded
16 Execution timed out 2051 ms 7476 KB Time limit exceeded
17 Execution timed out 2041 ms 23092 KB Time limit exceeded
18 Execution timed out 2013 ms 23124 KB Time limit exceeded
19 Execution timed out 2005 ms 22940 KB Time limit exceeded
20 Execution timed out 2074 ms 20568 KB Time limit exceeded
21 Execution timed out 2017 ms 36652 KB Time limit exceeded
22 Execution timed out 2073 ms 36520 KB Time limit exceeded
23 Execution timed out 2019 ms 31004 KB Time limit exceeded
24 Execution timed out 2037 ms 36636 KB Time limit exceeded
25 Execution timed out 2050 ms 47764 KB Time limit exceeded
26 Correct 499 ms 43860 KB Output is correct
27 Execution timed out 2029 ms 32432 KB Time limit exceeded
28 Execution timed out 2047 ms 32400 KB Time limit exceeded
29 Execution timed out 2019 ms 32176 KB Time limit exceeded
30 Execution timed out 2047 ms 31916 KB Time limit exceeded
31 Execution timed out 2012 ms 29788 KB Time limit exceeded
32 Execution timed out 2013 ms 32180 KB Time limit exceeded