#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
typedef long long LL; char s[];
vector<int> num[]; void dfs(int u, int k)
{
int d = num[u].size(), v;
for(int i = ; i < d; i++){
v = num[u][i];
for(int j = ; j < k; j++) printf(" ");
if(num[v].size()){
if(s[v] == '-'){printf("- object%d\n", v); dfs(v, k+);}
else printf("+ object%d\n", v);
}
else printf(" object%d\n", v);
/*
if(s[v] == '-'){
if(num[v].size()) {printf("- object%d\n", v); dfs(v, k+1);}
else printf(" object%d\n", v);
}
else if(s[v] == '+') printf("+ object%d\n", v);
*/ }
} int main()
{
#ifdef LOCAL
freopen("a.txt", "r", stdin);
//freopen("b.txt", "w", stdout);
int T = ;
while(T--){
#endif // LOCAL
int n, k, val;
scanf("%d", &n);
for(int i = ; i <= n; i++){
getchar();
scanf("%c", &s[i]);
scanf("%d", &k);
while(k--){
scanf("%d", &val);
num[i].push_back(val);
}
} if(n == ) {printf(" project\n");}
else{
if(s[] == '-'){
printf("- project\n");
dfs(, );
}
else printf("+ project\n");
} #ifdef LOCAL
printf("\n");
}
#endif // LOCAL
return ;
}

UESTC 2016 Summer Training #1 J - Objects Panel (A) 按条件遍历树的更多相关文章

  1. UESTC 2016 Summer Training #1 Div.2

    最近意志力好飘摇..不知道坚不坚持得下去.. 这么弱还瞎纠结...可以滚了.. 水题都不会做.. LCS (A) 水 LCS (B) 没有看题 Gym 100989C 水 1D Cafeteria ( ...

  2. UESTC 2016 Summer Training #6 Div.2

    我好菜啊.. UVALive 6434 给出 n 个数,分成m组,每组的价值为最大值减去最小值,每组至少有1个,如果这一组只有一个数的话,价值为0 问 最小的价值是多少 dp[i][j] 表示将 前 ...

  3. The Solution of UESTC 2016 Summer Training #1 Div.2 Problem C

    Link http://acm.hust.edu.cn/vjudge/contest/121539#problem/C Description standard input/output After ...

  4. The Solution of UESTC 2016 Summer Training #1 Div.2 Problem B

    Link http://acm.hust.edu.cn/vjudge/contest/121539#problem/B Description standard input/output Althou ...

  5. The Solution of UESTC 2016 Summer Training #1 Div.2 Problem A

    Link http://acm.hust.edu.cn/vjudge/contest/121539#problem/A Description standard input/output Haneen ...

  6. 2016 Multi-University Training Contest 1 J.Subway

    Subway Time Limit: 7000/3500 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Su ...

  7. 2016 Multi-University Training Contest 1 G. Rigid Frameworks

    Rigid Frameworks Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) ...

  8. 2016 Multi-University Training Contest 1

    8/11 2016 Multi-University Training Contest 1 官方题解 老年选手历险记 最小生成树+线性期望 A Abandoned country(BH) 题意: 1. ...

  9. 2016 Multi-University Training Contest 2

    8/13 2016 Multi-University Training Contest 2官方题解 数学 A Acperience(CYD)题意: 给定一个向量,求他减去一个  α(>=0)乘以 ...

随机推荐

  1. 《剑指offer》链表专题 (牛客10.23)

    难度 题目 知识点 03. 返回链表的反序 vector 递归,C++ STL reverse() * 14. 链表中倒数第k个结点 指针操作 15. 反转链表 头插法,递归 16. 合并两个有序链表 ...

  2. Had I not seen the Sun(如果我不曾见过太阳)

    Had I not seen the Sun by Emily Dickinson Had I not seen the Sun I could have borne the shade But Li ...

  3. 【并行计算-CUDA开发】 NVIDIA Jetson TX1

    概述 NVIDIA Jetson TX1是计算机视觉系统的SoM(system-on-module)解决方案.它组合了最新的NVIDIAMaxwell GPU架构,其具有ARM Cortex-A57 ...

  4. MIT 6.828 课程介绍

    MIT 6.828 课程介绍 本文是对MIT 6.828操作系统课程介绍的简单摘录,详细介绍见6.828: Learning by doing以及朱佳顺的推荐一门课:6.828.学习资源均可以在课程主 ...

  5. [转帖CCIX]

    业界七巨头联手,数据中心通过PCIe实现25Gbps数据通信! 2017-06-07 17:31 CCIX(Cache Coherent Interconnect for Accelerators,针 ...

  6. 使用jbc查询数据封装成对象的工具类

    适用于获取Connection对象的util package com.briup.myDataSource; import java.io.FileReader; import java.io.Inp ...

  7. 小记------phoenix安装搭建

        1.下载与hbase对应版本的phoenix      http://phoenix.apache.org/download.html   2.解压  tar -zxvf apache-pho ...

  8. (八)Spring 事务管理

    目录 文章目录 @[toc] **`Spring`** 事务管理 `Api` 介绍之 **`PlatformTransactionManager`** 后记 #Spring 的事务管理 编程式事务管理 ...

  9. (五)Spring 中的 aop

    目录 文章目录 AOP概念 AOP原理 AOP术语 **`Spring`** 中的 **`aop`** 的操作 使用 `AspectJ` 实现 `aop` 的两种方式 AOP概念 浅理解 aop :面 ...

  10. 模块和包,logging模块

    模块和包,logging日志 1.模块和包 什么是包? 只要文件夹下含有__init__.py文件就是一个包. 假设文件夹下有如下结构 bake ├── test.py ├── __init__.py ...