模拟题,map搞一搞。要想清楚一个结点应该是要通过一个字符串找到下一个结点,题目保证所以文件夹非空,所以只要判断一个结点是不是叶子结点就可以判断它是不是文件,用了点c11的特性。

#include<bits/stdc++.h>
using namespace std; typedef map<string,int> Node;
map<string,int>::iterator it_id;
const int maxnd = 1e4;
Node nds[maxnd];
int nds_cnt;
#define MP make_pair
#define fi first
#define se second inline int id(const string& s,Node& fa)
{
if((it_id = fa.find(s)) != fa.end()) return it_id->second;
fa.insert(MP(s,++nds_cnt));
return nds_cnt;
} int curFile,curFolder;
void dfs(int u)
{
for(auto it: nds[u]){
if(nds[it.se].empty()) { curFile++; continue; }
else curFolder++;
dfs(it.se);
}
} #define cer(x) cout<<x<<endl;
#define PB push_back int main()
{
//freopen("in.txt","r",stdin);
ios_base::sync_with_stdio(false);
string s;
while(cin>>s){
auto u = nds;
u = nds+id(s.substr(,),*u);
s.PB('\\');
for(int i = , j = ; i < (int)s.size(); i++){
if(s[i] == '\\'){
u = nds+id(s.substr(j,i-j),*u);
j = i+;
}
}
}
int maxFolder = ,maxFile = ; for(auto it: nds[]){
for(auto it2: nds[it.se]){
curFolder = curFile = ;
dfs(it2.se);
maxFolder = max(maxFolder,curFolder);
maxFile = max(maxFile,curFile);
}
}
cout<<maxFolder<<' '<<maxFile<<endl;
return ;
}

CodeForces 66C Petya and File System (实现)的更多相关文章

  1. Design and Implementation of the Sun Network File System

    Introduction The network file system(NFS) is a client/service application that provides shared file ...

  2. 乌版图 read-only file system

    今天在启动虚拟机的时候,运行命令svn up的时候,提示lock,并且read-only file system,这个....我是小白啊,怎么办?前辈在专心写代码,不好打扰,果断找度娘啊 于是乎,折腾 ...

  3. File system needs to be upgraded. You have version null and I want version 7

    安装hbase时候报错: File system needs to be upgraded. You have version null and I want version 7 注: 我安装的hba ...

  4. Linux系统启动错误 contains a file system with errors, check forced解决方法

    /dev/sda1 contains a file system with errors, check forced./dev/sda1: Inodes that were part of a cor ...

  5. Linux 执行partprobe命令时遇到Unable to open /dev/sr0 read-write (Read-only file system)

    在使用fdisk创建分区时,我们会使用partprobe命令可以使kernel重新读取分区信息,从而避免重启系统,但是有时候会遇到下面错误信息"Warning: Unable to open ...

  6. 磁盘、分区及Linux文件系统 [Disk, Partition, Linux File System]

    1.磁盘基础知识 1.1 物理结构 硬盘的物理结构一般由磁头与碟片.电动机.主控芯片与排线等部件组成:当主电动机带动碟片旋转时,副电动机带动一组(磁头)到相对应的碟片上并确定读取正面还是反面的碟面,磁 ...

  7. Linux File System

    目录 . Linux文件系统简介 . 通用文件模型 . VFS相关数据结构 . 处理VFS对象 . 标准函数 1. Linux文件系统简介 Linux系统由数以万计的文件组成,其数据存储在硬盘或者其他 ...

  8. ORA-00245: control file backup failed; target is likely on a local file system

    ORACLE11G RAC alert报错如下:Errors in file /u01/app/oracle/diag/rdbms/dljyzs/dljyzs1/trace/dljyzs1_ora_8 ...

  9. 读Avoiding the Disk Bottleneck in the Data Domain Deduplication File System

    最近在思考和实践怎样应用重复数据删除技术到云存储服务中.找了些论文来读,其中<Avoiding the Disk Bottleneck in the Data Domain Deduplicat ...

随机推荐

  1. linux下删除3分钟之前指定文件夹下的指定类型文件

    如果想要修改crontab,一般做以下的几步就可以了 将crontab 推到一个自定义的文件上 crontab -l>;tmp 编辑这个文件,做需要的修改 vi tmp 推回crontab cr ...

  2. VMWare虚拟机Bridged类型网卡ping不通的原因和解决办法

    要使VM与局域网内的其他机器一个子网,VM的网卡设置使用桥接.本来一直正常好好的, 突然有一天,遇到VMWare虚拟机Bridged类型网卡ping不通,设置,重启,查看VM网络设置,重装VMWare ...

  3. lung 分割论文

    <4D Lung Tumor Segmentation via Shape Prior and Motion Cues > Abstract— Lung tumor segmentatio ...

  4. atom 插件 python语法验证linter-flake8-------填坑

    python的语法相对于一般语言的语法比较严格.对于刚刚从前端入门python的我来说,有时候代码写完了,然后报错,好多语法错误.所以这个时候一个好的语法验证插件是很好的.linter-flake8这 ...

  5. python——基本数据类型1——简介

    列表 列表是可变数据类型.是序列类型; 列表的内容可以是数字,字符串和其它列表: 0第一个元素,-1最后一个元素, 定义连续列表 li = list(range(1,10,2)) 列表取值: 取 b: ...

  6. Educational Codeforces Round 65 (Rated for Div. 2) D. Bicolored RBS

    链接:https://codeforces.com/contest/1167/problem/D 题意: A string is called bracket sequence if it does ...

  7. HDU-3072-IntelligenceSystem(tarjan,贪心)

    链接:https://vjudge.net/problem/HDU-3072 题意: 给你n个点,1个点到另一个点连接花费c,但是如果几个点可以相互可达,则这几个点连通花费为0. 求将整个图连通的最小 ...

  8. System.Span, System.Memory,还有System.IO.Pipelines

    System.Span, System.Memory,还有System.IO.Pipelines 使用高性能Pipelines构建.NET通讯程序 .NET Standard支持一组新的API,Sys ...

  9. stm32的低功耗模式:

    一.待机模式.待机模式是低功耗中最低功耗的,内部电压调节电路被关闭,  HSE.HIS.PLL被关闭:进入待机模式后,SRAM和寄存器的内容将丢失.  (CPU停止,外设停止,RAM的数据寄存器的内容 ...

  10. PHP&Java 调用C#的WCF

    步骤一:用C#声明WCF [ServiceContract] public interface IService1 { [OperationContract] void DoWork(); [Oper ...