模拟题,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. bootstrap下拉框式标签页

    <ul id="myTab" class="nav nav-tabs"> <li class="active"> & ...

  2. oracle查看表,索引,视图,存储过程的定义

    通过  DBMS_METADATA  包 Oracle 的在线文档,对这个包有详细说明: DBMS_METADATA 通过该dbms_metadata包的get_ddl()方法,我们可以查看表,索引, ...

  3. SQL 分组获取产品 前两条记录

    select * from ( select *, ROW_NUMBER() over(partition by IPAddress order by recordtime desc) as rowN ...

  4. LeetCode: 669 Trim a Binary Search Tree(easy)

    题目: Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so th ...

  5. Python 绘制你想要的数学函数图形

    Python 非常热门,但除非工作需要没有刻意去了解更多,直到有个函数图要绘制,想起了它.结果发现,完全用不着明白什么是编程,就可以使用它完成很多数学函数图的绘制. 通过以下两个步骤,就可以进行数学函 ...

  6. Oracle SQL调优之分区表

    目录 一.分区表简介 二.分区表优势 三.分区表分类 3.1 范围分区 3.2 列表分区 3.3 散列分区 3.4 组合分区 四.分区相关操作 五.分区相关查询 附录:分区表索引失效的操作 一.分区表 ...

  7. qemu编译

    符号说明 $ 表示在用户模式下执行命令 # 表示在root模式下执行命令 ### 表示注释用于解释接下来一条命令的作用 更新环境源 设置阿里源 $ sudo mv /etc/yum.repos.d/C ...

  8. 洛谷P1044 栈(Catalan数)

    P1044 栈 题目背景 栈是计算机中经典的数据结构,简单的说,栈就是限制在一端进行插入删除操作的线性表. 栈有两种最重要的操作,即pop(从栈顶弹出一个元素)和push(将一个元素进栈). 栈的重要 ...

  9. 2015 Noip提高组 Day2

    P2678 跳石头 [题目背景] 一年一度的“跳石头”比赛又要开始了! [题目描述] 这项比赛将在一条笔直的河道中进行,河道中分布着一些巨大岩石.组委会已经选择好了两块岩石作为比赛起点和终点.在起点和 ...

  10. 洛谷P1002 过河卒

    关于蒟蒻的我,刚刚接触DP....   那么就来做一道简单DP吧.... 首先先看题: 题目描述 棋盘上AA点有一个过河卒,需要走到目标BB点.卒行走的规则:可以向下.或者向右.同时在棋盘上CC点有一 ...