请求加强数据
查看原帖
请求加强数据
696391
The_Chariot楼主2024/8/23 11:48

考场代码

#include<bits/stdc++.h>
using namespace std;
int n,m;
struct node{
	int id,v;
};
queue<node >q;
int main() {
	cin>>n>>m;
	for(int i=1;i<=n;i++)
	{
		node r;
		cin>>r.v;
		r.id=i;
		q.push(r);
	}
	int old=0;
	while(!q.empty())
	{
		if(old==q.front().v)
		{
			node y=q.front();
			q.pop();
			q.push(y);
		}
		else{
			cout<<q.front().id<<endl;
			old=q.front().v;
			q.pop();
		}
	}
	return 0;
}

数据范围我认为最坏情况下是O(nm∗n)O(nm*n),应该是过不了此题的(最大数据下每种相同的类型的歌曲连续输入)

(有错误请指出)

2024/8/23 11:48
加载中...