QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#665537#6434. Paimon Sortinglaing2122Compile Error//C++17887b2024-10-22 13:55:352024-10-22 13:55:38

Judging History

你现在查看的是最新测评结果

  • [2024-10-22 13:55:38]
  • 评测
  • [2024-10-22 13:55:35]
  • 提交

answer

#include<iostream>
#include<algorithm>
#include<vector>
#include<map>
#include<array>
#include<random>
#include<string>
#include<time.h>
#include<cstring>
#include<set>
#include<cmath>
#include<queue>
#define int long long
#define endl '\n'
#define F first
#define S second
#define sz size()
#define ln cout<<'\n'
#define B begin()
#define pb push_back
#define D end()
#define pii pair<int,int> 

using namespace std;
const int N=3e6+10;
const int mod=1e9;  
void solve()
{
int n;cin>>n;
	vector<int>a(n+1);
	for(int i=1;i<=n;i++) cin>>a[i];
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		for(int j=1;j<=n;j++)
		{
			if(a[i]<a[j])
			{
				swap(a[i],a[j]);
				ans++;
			}
		}
	}
	return ans;
}
signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int tc=1;
	//cin>>tc;
	while(tc--)
	{
		solve();
	}
	//cout<<"dafc";
	return 0;
}

Details

answer.code: In function ‘void solve()’:
answer.code:44:16: error: return-statement with a value, in function returning ‘void’ [-fpermissive]
   44 |         return ans;
      |                ^~~