Submission #312064

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
3120642020-10-12 09:05:27colazcyClickbait (COCI18_clickbait)C++17
0 / 120
19 ms24960 KiB
#include <cstdio>
#include <cctype>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
const int maxn = 1024;
char mp[maxn][maxn];
int n,m,tot,ans[maxn * maxn],id[maxn][maxn],vis[maxn][maxn],deltax[] = {-1,1,0,0},deltay[] = {0,0,-1,1};
inline bool chk(int x,int y){
return x >= 1 && x <= n && y >= 1 && y <= m;
}
struct point{int x,y;};
inline void bfs(point s,int col){
queue<point> q;
q.push(s);vis[s.x][s.y] = 1;
while(!q.empty()){
point now = q.front();q.pop();
id[now.x][now.y] = col;
for(int i = 0;i < 4;i++){
int nx = now.x + deltax[i],ny = now.y + deltay[i];
if(!chk(nx,ny) || vis[nx][ny])continue;
if(mp[nx][ny] == '.' || isdigit(mp[nx][ny]))q.push(point{nx,ny}),vis[nx][ny] = 1;
else id[nx][ny] = col,vis[nx][ny] = 1;
}
}
}
inline int find(point now){
while(!id[now.x][now.y]){
vis[now.x][now.y] = 1;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

clickbait.cpp: In function 'void dfs(int)':
clickbait.cpp:58:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<edge>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |  for(int i = 0;i < G[u].size();i++){
      |                ~~^~~~~~~~~~~~~
clickbait.cpp: In function 'int main()':
clickbait.cpp:78:6: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
   78 |    if(mp[i][j] == '|')
      |      ^
clickbait.cpp:65:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)', declared with attribute warn_unused_result [-Wunused-result]
   65 |  freopen("clickbait.in","r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
clickbait.cpp:67:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   67 |  scanf("%d %d",&n,&m);
      |  ~~~~~^~~~~~~~~~~~~~~
clickbait.cpp:68:32: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   68 |  for(int i = 1;i <= n;i++)scanf("%s",mp[i] + 1);
      |                           ~~~~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...