#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. Java工程师学习指南第3部分:Spring与SpringMVC源码解析

    本文整理了微信公众号[Java技术江湖]发表和转载过的Spring全家桶优质文章,想看到更多Java技术文章,就赶紧关注吧. 前后端分离,我怎么就选择了 Spring Boot + Vue 技术栈? ...

  2. Public thanks to Shao Qirui for his contribution to open source software

    Public thanks to Shao Qirui for his contribution to open source softwareShao Qirui is a student, but ...

  3. CTF基础知识 && AWD红蓝对抗

    AWD 备份源码,修改账户密码,查看是否有预留后门然后删掉 修改mysql密码 格式:mysqladmin -u用户名 -p旧密码 password 新密码 例子:mysqladmin -uroot ...

  4. selenium3关于ddt数据驱动。。

    from selenium import webdriver import ddt import time import unittest @ddt.ddt class TestLogin(unitt ...

  5. IO-file 02 文件的状态

    package com.bwie.io; import java.io.File; /** * 文件状态 * 1.不存在  exists * 2.存在 *      文件:isFile *      ...

  6. 《MIT 6.828 Lab 1 Exercise 10》实验报告

    本实验的网站链接:MIT 6.828 Lab 1 Exercise 10. 题目 Exercise 10. To become familiar with the C calling conventi ...

  7. (四)mybatis 的主键返回

    目录 文章目录 自增主键(LAST_INSERT_ID()) 非自增主键(UUID() ) 自增主键(LAST_INSERT_ID()) 在映射关系文件中配置 <!--插入用户--> &l ...

  8. fiddler笔记:状态面板

    Capturing 指示Fiddler是否开启抓包. Process-based Filter 显示Fiddler当前正在捕获的流量进程类型点击面板可以显示进程类型的过滤选项菜单 Automatic ...

  9. 【Python基础】07_Python中的模块

    1.模块的概念 模块 就好比 工具包,要想使用这个工具包中的工具,就需要 导入import 这个模块 每一个以扩展名 .py 结尾的 Python源代码文件 都是一个 模块 在模块中定义的 全局变量. ...

  10. __formart__

    __format__ 一.__format__ 自定制格式化字符串 date_dic = { 'ymd': '{0.year}:{0.month}:{0.day}', 'dmy': '{0.day}/ ...