제출 #826179

#제출 시각아이디문제언어결과실행 시간메모리
826179abode_at25Tracks in the Snow (BOI13_tracks)C++17
0 / 100
1221 ms79828 KiB
#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;
}

컴파일 시 표준 에러 (stderr) 메시지

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...