# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
312064 | colazcy | Clickbait (COCI18_clickbait) | C++17 | 19 ms | 24960 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |