关于 map 时间复杂度
  • 板块学术版
  • 楼主潘德理2010
  • 当前回复3
  • 已保存回复3
  • 发布时间2023/10/7 21:16
  • 上次更新2023/11/2 14:59:40
查看原帖
关于 map 时间复杂度
572133
潘德理2010楼主2023/10/7 21:16

以下代码的时间复杂度是?

#include<bits/stdc++.h>
using namespace std;
int n,t;
map<int,int> m;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++) scanf("%d",&t),m[t]++;
	for(map<int,int>::iterator it=m.begin();it!=m.end();it++) printf("%d %d\n",it->first,it->second);
	return 0;
}
2023/10/7 21:16
加载中...