70分3TLE悬关
查看原帖
70分3TLE悬关
1327102
tysy_020楼主2024/8/11 14:44
#include<bits/stdc++.h>
using namespace std;
int q[1000005],w[1000005];
void Sort(int m)
{
	for(int l=0;l<m;l++)
    {
    	for(int j=l+1;j<m;j++)
    	{
    		if(q[l]>q[j])
    		{
    			int r=q[l];
    			q[l]=q[j];
    			q[j]=r;
    			w[l]=1;
    			w[j]=1;
    			r=w[l];
    			w[l]=w[j];
    			w[j]=r;
			}
		}
	}
}
int main()
{
    int n;
    cin >> n;
    for(int i=0;i<n;i++)
    {
    	int m,x=0;
    	cin >> m;
    	for(int l=0;l<m;l++)
    	{
    		cin >> q[l];
    		w[l]=0;
		}
    	Sort(m);
		for(int l=0;l<m;l++)
		{
			if(w[l]==1)
				x++;
		}
		cout << x << endl;
	}
    return 0;
}
2024/8/11 14:44
加载中...