Codeforces Round #256 (Div. 2) #B Suffix Structures
来源:互联网 发布:晨光麦事件 知乎 编辑:程序博客网 时间:2024/05/25 08:13
#include <iostream>#include <string>using namespace std;bool bothmethods(string s, string t) {int a[505] = {};for (int i = 0; i < s.size(); ++i) {++a[s[i]];}for (int i = 0; i < t.size(); ++i) {--a[t[i]];}for (int i = 0; i < 505; ++i) {if(a[i] < 0) {return false;}}return true;}bool onlyCHANGE(string s, string t) {int a[505] = {};for (int i = 0; i < s.size(); ++i) {++a[s[i]];}for (int i = 0; i < t.size(); ++i) {--a[t[i]];}for (int i = 0; i < 505; ++i) {if (a[i] != 0) {return false;}}return true;}bool onlyDEL(string s, string t) {for (int i = 0; i < t.size(); ++i) {while (i < s.size() && s[i] != t[i]) {s.erase(i, 1);}if (i >= s.size()) {return false;}}return true;}int main(){string s, t;while (cin >> s >> t) {if (bothmethods(s, t)) {if (onlyDEL(s, t)){cout << "automaton" << endl;}else if (onlyCHANGE(s, t)) {cout << "array" << endl;}else {cout << "both" << endl;}}else {cout << "need tree" << endl;}}return 0;}
0 0
- Codeforces Round #256 (Div. 2) B. Suffix Structures
- Codeforces Round #256 (Div. 2) #B Suffix Structures
- Codeforces Round #256 (Div. 2) B. Suffix Structures
- Codeforces Round #256 (Div. 2) B. Suffix Structures(模拟)
- Codeforces Round #256 (Div. 2) B. Suffix Structures
- Codeforces Round #256 (Div. 2) B. Suffix Structures (乱搞)
- Codeforces Div. 2 #256-B. Suffix Structures
- Codeforces Round #256 (Div. 2) B (448B) Suffix Structures
- codeforces Div.2 B.Suffix Structures
- Suffix Structures - #256 (Div. 2) B (448B) 陷阱题
- codeforces B. Suffix Structures
- Codeforces Round #256 (Div. 2/B)/Codeforces448B_Suffix Structures(字符串处理)
- Codeforces Round #299 (Div. 2) D. Tavas and Malekas KMP+预处理、string suffix structures
- Codeforces 448B. Suffix Structures
- Codeforces 448B Suffix Structures
- CodeForces 448-B. Suffix Structures
- CodeForces 448B Suffix Structures
- codeforces 448 B. Suffix Structures
- 在新浪云sae上搭建微信公众平台消息有时不回复的问题
- 彻底理解position与anchorPoint
- linux环境下安装PHP中间件ICE(一)
- 移动应用的主战场是游戏
- 超级硬盘数据恢复软件 4.6.5.0注册码破解版
- Codeforces Round #256 (Div. 2) #B Suffix Structures
- linux环境下安装PHP中间件ICE(二)
- linux环境下安装PHP中间件ICE(三)
- Jetty开发指导:Maven和Jetty
- 用实验方法加深理解Oracle的外连接(left/right/full)和内连接(inner)
- linux环境下编译安装ICE
- poj 1321
- GCD--自己的开发笔记
- ARC和非ARC混编