#include <iostream>
#include <set>
#include <stack>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;
#define ALL(x) x.begin(), x.end()
#define INS(x) inserter(x, x.begin())
int t, n;
typedef set<int> Set;
map<Set, int> IDcache;
vector<Set> Setcache;
int ID(Set x)
{
if(IDcache.count(x)) return IDcache[x];
Setcache.push_back(x);
return IDcache[x] = Setcache.size()-1;
}
int main()
{
cin >> t;
while(t--)
{
IDcache.clear(); //其实不用clear也没关系 只是取个ID而已 对结果没影响
Setcache.clear(); //速度反而会更快
stack<int> s;
cin >> n;
for(int i = 0; i < n; i++)
{
string op;
cin >> op;
if(op[0] == 'P') s.push(ID(Set()));
else if(op[0] == 'D') s.push(s.top());
else{
Set x1
12096 - The SetStack Computer
最新推荐文章于 2020-03-13 22:02:10 发布
本文详细探讨了SetStack计算机的设计理念,它是一种创新的计算模型,以其独特的栈操作方式改变了传统计算机架构。内容包括SetStack的工作原理、优势、应用领域以及与现有计算机系统的比较。
摘要由CSDN通过智能技术生成