当前位置:网站首页>1091 acute stroke (30 points)
1091 acute stroke (30 points)
2022-07-22 20:34:00 【Konjaku for learning programming】
1091 Acute Stroke (30 branch )
Update ideas when available
#include <iostream>
#include <queue>
using namespace std;
int dir[6][3] = {
{
1, 0, 0}, {
0, 1, 0}, {
0, 0, 1}, {
-1, 0, 0}, {
0, -1, 0}, {
0, 0, -1}};
struct node{
int x, y, z;
};
int a[1300][130][70], vis[1300][130][70];
int n, m, l, T, ans;
int bfs(int x, int y, int z) {
int ret = 0;
node t = {
x, y, z};
queue<node> q;
q.push(t);
vis[x][y][z] = 1;
while(!q.empty()) {
t = q.front();
q.pop();
ret++;
for(int i = 0; i < 6; ++i){
int xx = t.x + dir[i][0], yy = t.y + dir[i][1], zz = t.z + dir[i][2];
if(xx < 0 || x >= m || y < 0 || y >= n || z < 0 || z >=l || vis[xx][yy][zz] || a[xx][yy][zz] == 0)
continue;
vis[xx][yy][zz] = 1;
q.push({
xx, yy, zz});
}
}
if(ret >= T)
return ret;
else
return 0;
}
int main() {
cin >> m >> n >> l >> T;
for(int i = 0; i < l; ++i)
for(int j = 0; j < m; ++j)
for(int k = 0; k < n; ++k)
cin >> a[j][k][i];
for(int i = 0; i < l; ++i)
for(int j = 0; j < m; ++j)
for(int k = 0; k < n; ++k)
if(!vis[j][k][i] && a[j][k][i] == 1)
ans += bfs(j, k, i);
cout << ans;
}
边栏推荐
- 1034 head of a gang (30 points)
- JSON output to file line by line in format
- Deep understanding of MMAP function
- Pytorch不同层设置不同学习率
- Flask cross domain
- JDBC异常SQLException的捕获与处理
- 【文献阅读与想法笔记13】Pre-Trained Image Processing Transformer
- [literature reading and thought notes 14] beyond a Gaussian noise: residual learning of deep CNN for image recognition
- Her power series five Zhu Haiyi: people oriented, building AI values
- Signal noise reduction method
猜你喜欢
Latex在VSCODE中编译报错`Recipe terminated with error. Retry building the project.
Kubernetes基础
本地镜像发布到私有库
Introduction to machine learning: support vector machine-6
Her power series II UCLA Li Jingyi: the last thing women need to do is "doubt themselves"
配置属于自己的Vim-编辑器之神
[literature reading and thought notes 13] pre trained image processing transformer
模拟学生信息输入界面
LeetCode912——sort an array—— quick sort algorithm
YOLO v1、v2、v3
随机推荐
LeetCode0003——longest substring without repeating characters——Sliding Window
Unix C语言POSIX的线程创建、获取线程ID、汇合线程、分离线程、终止线程、线程的比较
1080 Graduate Admission (30 分)
Pytoch sets different learning rates at different levels
她力量系列七丨兰艳艳:理想温暖10年科研路,女性可以柔和,更要自信、专业 | 妇女节特辑
Function principle of pytoch network training process: source code analysis optimizer.zero_ grad()loss.backward()optimizer.step()
Getting started with CSDN markdown editor
c语言bitField
Kubernetes基础
《预训练周刊》第39期: 深度模型、提示学习
Leetcode0002——Add Two Numbers——Linked List
VSCODE 比较两个文件
Aminer paper recommendation
Pytorch不同层设置不同学习率
[literature reading and thought notes 14] beyond a Gaussian noise: residual learning of deep CNN for image recognition
Generate an external inspection script to delete all tables in the database
Usage and precautions of accumulator used in spark
mysql重要配置参数整理
1076 Forwards on Weibo (30 分)
7-2 Rank a Linked List (25 分)