Description

Input

Output

Sample Input

3
A+00A+A+ 00B+D+A- B-C+00C+

Sample Output

bounded

Hint

题解

 //It is made by Awson on 2017.9.19
#include <map>
#include <set>
#include <cmath>
#include <ctime>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) < (b) ? (a) : (b))
#define Abs(a) ((a) < 0 ? (-(a)) : (a))
using namespace std; int n; int getnum(char x, char y) {
if (x == '') return ;
return x-'A'+*(y == '+');
}
void work() {
char ch[];
bool mp[][] = {};
int in[] = {};
for (int T = ; T <= n; T++) {
scanf("%s", ch+);
for (int i = ; i <= ; i += )
for (int j = ; j <= ; j += )
if (i != j) {
int x = getnum(ch[i], ch[i+]);
int y = getnum(ch[j], ch[j+]);
if (x == || y == ) continue;
if (y < ) y += ;
else y -= ;
mp[x][y] = true;
}
}
for (int i = ; i <= ; i++)
for (int j = ; j <= ; j++)
if (mp[i][j]) in[j]++;
int cnt = ;
queue<int>Q;
while (!Q.empty()) Q.pop();
for (int i = ; i <= ; i++)
if (!in[i]) Q.push(i);
while (!Q.empty()) {
int u = Q.front(); Q.pop();
cnt++;
for (int i = ; i <= ; i++)
if (mp[u][i]) {
in[i]--;
if (!in[i]) Q.push(i);
}
}
printf("%s\n", cnt < ? "unbounded" : "bounded");
} int main() {
freopen("gene.in", "r", stdin);
freopen("gene.out", "w", stdout);
while (~scanf("%d", &n))
work();
return ;
}

最新文章

  1. Chocolatey
  2. CodeForces 701C They Are Everywhere (滑动窗口)
  3. MVC如何配置才能访问静态页面
  4. AO中的GraphicsLayer---------元素的容器
  5. [大牛翻译系列]Hadoop(19)MapReduce 文件处理:基于压缩的高效存储(二)
  6. (转载)PHP怎么获取MySQL执行sql语句的查询时间
  7. Lintcode--002(两个字符串是变位词)
  8. linux input如何固定设备event handler
  9. UVa 10360 - Rat Attack
  10. 撒花!中文翻译仓库链接已加入 ML.NET 官方示例网站首页
  11. 【性能提升神器】Covering Indexes
  12. hdoj:2086
  13. CloudSim——云计算仿真软件概述
  14. bozj 1823(未完成)
  15. eclipse设置字体_字符编码_快捷键
  16. Web 开发最有用的50款 jQuery 插件集锦——《内容滑块篇》
  17. 不同路径 II
  18. sbt第一次运行下载jar包很慢解决办法
  19. 【堆的启发式合并】【P5290】[十二省联考2019]春节十二响
  20. eclipse 配置

热门文章

  1. IDEA配置Struts框架
  2. W班-项目选题报告成绩
  3. Python多线程案例
  4. 第一周-JAVA基本概念
  5. centos 开放端口
  6. hibernate懒加载导致jackjson解析json时StackOverFlow
  7. 点开GitHub之后,瑟瑟发抖...的我
  8. api-gateway实践(15)3.6JL分支和3.7并行改造需求
  9. hadoop2.6.0实践:A01 问题处理 DEPRECATED: Use of this script to execute hdfs command is deprecated.
  10. 记一次将公司网站http换成https