模拟题,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. 再论c#获取存储过程返回值(包括SqlSugar)

    其实这个问题好多年以前研究过: https://blog.csdn.net/xpnew/article/details/6909902 最近因为需要统计日结月结,给同事写了一套调用存储过程的代码.同时 ...

  2. 如何使用jmeter连接数据库并提取数据库中的值作为参数,与响应信息中提取的值进行比较

    思路: 连接数据库 获取数据库返回的数据 获取接口返回的数据 两者返回数据进行对比验证 连接数据库 1.jmeter要链接mysql数据库,首先得下载mysql jdbc驱动包(注:驱动包的版本一定要 ...

  3. js 常用排序

    1. 冒泡排序 原理:从第一个元素开始,把当前元素和下一个索引元素进行比较.如果当前元素大,那么就交换位置,重复操作直到比较到最后一个元素 function bubbleSort(arr) { if ...

  4. VBA for AutoCAD

    Download the Microsoft Visual Basic for Applications Module (VBA) 2016 Downloads AutoCAD 2016 VBA mo ...

  5. JDK自带反编译工具javap

    在JDK的bin文件夹下,有许多自带工具: javap就是其中的一个,对应为 javap.exe javap可反编译查看Java编译器编译生成的字节码文件, 语法: javap [ options ] ...

  6. hadoop分布式存储(1)-hadoop基础概念

    hadoop是一种用于海量数据存储.管理.分析的分布式系统.需要hadoop需要储备一定的基础知识:1.掌握一定的linux操作命令 2.会java编程.因此hadoop必须安装在有jdk的linux ...

  7. Net Core免费开源分布式异常日志收集框架Exceptionless

    asp.Net Core免费开源分布式异常日志收集框架Exceptionless安装配置以及简单使用图文教程 https://www.cnblogs.com/yilezhu/p/9193723.htm ...

  8. JavaScript实现一个简单的密码输入功能

    常见的密码输入框当输入字符后会被替换成‘*’,而且旁边会有个小眼睛可以查看原本的字符,虽然input标签有这个功能,但这只是自己正在看正则表达式的时候突然想到的,就当做个练习,自己手动实现下: < ...

  9. Code First 2

    在codefirst一中也说了Mapping是实体与数据库的纽带,model通过Mapping映射到数据库,我们可以从数据库的角度来分析?首先是映射到数据库,这个是必须的.数据库里面一般包括表.列.约 ...

  10. HubbleDotNet 使用类

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using Hubble.S ...