[测试题]gene
2024-08-24 23:38:51
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 ;
}
最新文章
- Chocolatey
- CodeForces 701C They Are Everywhere (滑动窗口)
- MVC如何配置才能访问静态页面
- AO中的GraphicsLayer---------元素的容器
- [大牛翻译系列]Hadoop(19)MapReduce 文件处理:基于压缩的高效存储(二)
- (转载)PHP怎么获取MySQL执行sql语句的查询时间
- Lintcode--002(两个字符串是变位词)
- linux input如何固定设备event handler
- UVa 10360 - Rat Attack
- 撒花!中文翻译仓库链接已加入 ML.NET 官方示例网站首页
- 【性能提升神器】Covering Indexes
- hdoj:2086
- CloudSim——云计算仿真软件概述
- bozj 1823(未完成)
- eclipse设置字体_字符编码_快捷键
- Web 开发最有用的50款 jQuery 插件集锦——《内容滑块篇》
- 不同路径 II
- sbt第一次运行下载jar包很慢解决办法
- 【堆的启发式合并】【P5290】[十二省联考2019]春节十二响
- eclipse 配置
热门文章
- IDEA配置Struts框架
- W班-项目选题报告成绩
- Python多线程案例
- 第一周-JAVA基本概念
- centos 开放端口
- hibernate懒加载导致jackjson解析json时StackOverFlow
- 点开GitHub之后,瑟瑟发抖...的我
- api-gateway实践(15)3.6JL分支和3.7并行改造需求
- hadoop2.6.0实践:A01 问题处理 DEPRECATED: Use of this script to execute hdfs command is deprecated.
- 记一次将公司网站http换成https