30分求助!
查看原帖
30分求助!
1393704
langmou楼主2024/9/22 22:57

提交记录在这里

#include<bits/stdc++.h>
using namespace std;
int m, n, a[100010], t, q;
int x[305][100010], b[310], c[310], k[310], qwe,qwq;
string s;
signed main()
{
	cin >> m >> n;
	for (int i = 0; i < m; i++)
	{
		scanf("%d", a + i);
	}
	cin >> t;
	while (t--)
	{
		cin >> s;
		if (s == "push")
		{
			cin >> q;
			if (b[a[q]] == 0)
			{
				k[qwe] = a[q];
				qwe++;
			}
			x[a[q]][b[a[q]]] = q;
			b[a[q]]++;
			continue;
		}
		for (int i = qwq; i < qwe; i++)
		{
			if (c[k[i]] == b[k[i]]){
				qwq++;
				c[k[i]]=0;
				b[k[i]]=0;
				continue;
			}
			cout << x[k[i]][c[k[i]]] << endl;
			c[k[i]]++;
			break;
		}
	}
	return 0;
}
2024/9/22 22:57
加载中...