每题都是TLE
查看原帖
每题都是TLE
786689
littleqwq楼主2023/8/25 21:56
#include<bits/stdc++.h>
using namespace std;
int n,a[1000001],cnt;
bool vis[1000001];
bool pd;
int main(){
	cin >> n;
    cin.sync_with_stdio(0);
	cin.tie(0);
	for(int i=1;i<=n;i++) cin >> a[i];
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i++){
		cnt=0;
		pd=true;
		for(int j=1;j<=n;j++){
			if(!vis[j]){
				if(a[i]==a[j]){
					pd=false;
					vis[j]=1;
					cnt++;
				}
			}
		}
		if(!pd)
			cout<<a[i]<<' '<<cnt<<endl; 
	}
	return 0;
} 
2023/8/25 21:56
加载中...