Submission #826179

# Submission time Handle Problem Language Result Execution time Memory
826179 2023-08-15T10:56:32 Z abode_at25 Tracks in the Snow (BOI13_tracks) C++17
0 / 100
1221 ms 79828 KB
#include <bits/stdc++.h>
#include <vector>
#define coy cout<<"YES"<<endl
#define con cout<<"NO"<<endl
#define ll long long int
#define ull unsigned long long int
#define forn(i,a,n) for(i=a;i<n;i++)
#include<iterator>
#include <map>
#define fi first
#define se second
#define pb push_back
#define all(v) v.begin(),v.end()
using namespace std;


int main()
{ll inf=10000000000000;
   ull k,h,i,t,j,n,m;
cin>>n>>m;
char a[n][m];
bool vis[n+1][m+1];
char dist[n+1][m+1];
forn(i,0,n)
forn(j,0,m)
{cin>>a[i][j];
if(a[i][j]=='.')
{
vis[i][j]=true;
}
else
    vis[i][j]=false;
}
vector<pair<ll,ll> > v={{1,0},{0,1},{-1,0},{0,-1}};
queue<pair<ll,ll> > q;
map <char,ll> mp;
ll ans=0;
forn(i,0,n)
{forn(j,0,m)
{if(vis[i][j])
    continue;
    q.push({i,j});

        while(!q.empty())
        {ll s=q.front().fi;
        ll e=q.front().se;
        q.pop();
        mp[a[s][e]]++;
        if(vis[s][e])
            continue;
            vis[s][e]=true;
        for(auto u:v)
            {if(s+u.fi<0||s+u.fi>n)
                continue;
                if(e+u.se<0||e+u.se>m)
                continue;
                if(vis[s+u.fi][e+u.se])
                continue;

                q.push({s+u.fi,e+u.se});

            }
        }
    if(mp['F']>0)
{ans++;
mp['F']=0;}
 if(mp['R']>0)
{ans++;
mp['R']=0;}

}
}

cout<<ans<<endl;


    return 0;
}

Compilation message

tracks.cpp: In function 'int main()':
tracks.cpp:40:2: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   40 | {if(vis[i][j])
      |  ^~
tracks.cpp:42:5: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   42 |     q.push({i,j});
      |     ^
tracks.cpp:49:9: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   49 |         if(vis[s][e])
      |         ^~
tracks.cpp:51:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   51 |             vis[s][e]=true;
      |             ^~~
tracks.cpp:53:33: warning: comparison of integer expressions of different signedness: 'long long int' and 'long long unsigned int' [-Wsign-compare]
   53 |             {if(s+u.fi<0||s+u.fi>n)
      |                           ~~~~~~^~
tracks.cpp:53:14: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   53 |             {if(s+u.fi<0||s+u.fi>n)
      |              ^~
tracks.cpp:55:17: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   55 |                 if(e+u.se<0||e+u.se>m)
      |                 ^~
tracks.cpp:55:36: warning: comparison of integer expressions of different signedness: 'long long int' and 'long long unsigned int' [-Wsign-compare]
   55 |                 if(e+u.se<0||e+u.se>m)
      |                              ~~~~~~^~
tracks.cpp:18:5: warning: unused variable 'inf' [-Wunused-variable]
   18 | {ll inf=10000000000000;
      |     ^~~
tracks.cpp:19:8: warning: unused variable 'k' [-Wunused-variable]
   19 |    ull k,h,i,t,j,n,m;
      |        ^
tracks.cpp:19:10: warning: unused variable 'h' [-Wunused-variable]
   19 |    ull k,h,i,t,j,n,m;
      |          ^
tracks.cpp:19:14: warning: unused variable 't' [-Wunused-variable]
   19 |    ull k,h,i,t,j,n,m;
      |              ^
tracks.cpp:23:6: warning: unused variable 'dist' [-Wunused-variable]
   23 | char dist[n+1][m+1];
      |      ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 17 ms 1008 KB Output isn't correct
2 Incorrect 1 ms 300 KB Output isn't correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Incorrect 10 ms 692 KB Output isn't correct
5 Incorrect 4 ms 468 KB Output isn't correct
6 Incorrect 0 ms 212 KB Output isn't correct
7 Incorrect 1 ms 212 KB Output isn't correct
8 Incorrect 1 ms 304 KB Output isn't correct
9 Incorrect 1 ms 212 KB Output isn't correct
10 Incorrect 4 ms 468 KB Output isn't correct
11 Incorrect 3 ms 416 KB Output isn't correct
12 Incorrect 6 ms 468 KB Output isn't correct
13 Incorrect 4 ms 444 KB Output isn't correct
14 Incorrect 4 ms 440 KB Output isn't correct
15 Incorrect 15 ms 1032 KB Output isn't correct
16 Incorrect 17 ms 1016 KB Output isn't correct
17 Incorrect 12 ms 1000 KB Output isn't correct
18 Incorrect 10 ms 756 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 440 KB Output isn't correct
2 Incorrect 76 ms 4856 KB Output isn't correct
3 Incorrect 673 ms 47180 KB Output isn't correct
4 Incorrect 183 ms 11300 KB Output isn't correct
5 Incorrect 471 ms 26708 KB Output isn't correct
6 Runtime error 1117 ms 79828 KB Execution killed with signal 11
7 Incorrect 2 ms 340 KB Output isn't correct
8 Incorrect 3 ms 340 KB Output isn't correct
9 Runtime error 3 ms 596 KB Execution killed with signal 11
10 Incorrect 2 ms 340 KB Output isn't correct
11 Incorrect 2 ms 436 KB Output isn't correct
12 Incorrect 1 ms 308 KB Output isn't correct
13 Incorrect 77 ms 4860 KB Output isn't correct
14 Incorrect 44 ms 2940 KB Output isn't correct
15 Incorrect 45 ms 3120 KB Output isn't correct
16 Incorrect 34 ms 2176 KB Output isn't correct
17 Incorrect 198 ms 12164 KB Output isn't correct
18 Incorrect 180 ms 11980 KB Output isn't correct
19 Incorrect 152 ms 11196 KB Output isn't correct
20 Incorrect 151 ms 10316 KB Output isn't correct
21 Incorrect 399 ms 27632 KB Output isn't correct
22 Incorrect 467 ms 26748 KB Output isn't correct
23 Incorrect 396 ms 23156 KB Output isn't correct
24 Incorrect 413 ms 26892 KB Output isn't correct
25 Runtime error 572 ms 79588 KB Execution killed with signal 11
26 Runtime error 826 ms 61244 KB Execution killed with signal 11
27 Incorrect 1149 ms 47504 KB Output isn't correct
28 Incorrect 1204 ms 47340 KB Output isn't correct
29 Incorrect 1221 ms 47452 KB Output isn't correct
30 Incorrect 1147 ms 46408 KB Output isn't correct
31 Incorrect 799 ms 30492 KB Output isn't correct
32 Runtime error 1043 ms 79744 KB Execution killed with signal 11