120882024-12-02 09:02:11RRoliNegáló rendezés (55 pont)cpp17Accepted 55/5543ms1148 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n, MOD = 1e9+7;
	cin >> n;
	vector<int> v(n);
	for(int i = 0; i < n; i++) cin >> v[i];

	sort(v.begin(), v.end());
	v.push_back(-1);

	unsigned long long p = 1;
	int c = 1;
	bool elso = true;
	for(int i = 1; i <= n; i++) {
		if(v[i] == v[i-1]) c++;
		else {
			if(!elso) p = p*(c+1) % MOD;
			else elso = false;
			c = 1;
		}
	}
	cout << p;

	return 0;
}
SubtaskSumTestVerdictTimeMemory
base55/55
1Accepted0/01ms320 KiB
2Accepted0/043ms1080 KiB
3Accepted2/21ms320 KiB
4Accepted2/21ms320 KiB
5Accepted2/21ms320 KiB
6Accepted2/21ms320 KiB
7Accepted3/31ms320 KiB
8Accepted2/21ms396 KiB
9Accepted3/31ms320 KiB
10Accepted3/339ms1080 KiB
11Accepted3/343ms1080 KiB
12Accepted3/335ms1064 KiB
13Accepted3/334ms1148 KiB
14Accepted3/341ms1060 KiB
15Accepted3/339ms1064 KiB
16Accepted3/343ms1064 KiB
17Accepted3/339ms1052 KiB
18Accepted3/341ms988 KiB
19Accepted3/343ms1080 KiB
20Accepted3/341ms1060 KiB
21Accepted3/337ms1028 KiB
22Accepted3/339ms1080 KiB