120862024-12-02 08:54:27RRoliNegáló rendezés (55 pont)cpp17Wrong answer 14/5543ms1080 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	int n, MOD = 1e9;
	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
base14/55
1Accepted0/01ms320 KiB
2Wrong answer0/043ms1080 KiB
3Accepted2/21ms320 KiB
4Accepted2/21ms320 KiB
5Accepted2/21ms388 KiB
6Accepted2/21ms320 KiB
7Accepted3/31ms320 KiB
8Wrong answer0/21ms320 KiB
9Wrong answer0/31ms320 KiB
10Wrong answer0/339ms1024 KiB
11Wrong answer0/343ms1060 KiB
12Accepted3/335ms1060 KiB
13Wrong answer0/335ms1064 KiB
14Wrong answer0/341ms1080 KiB
15Wrong answer0/339ms1080 KiB
16Wrong answer0/343ms1060 KiB
17Wrong answer0/339ms1052 KiB
18Wrong answer0/341ms1064 KiB
19Wrong answer0/343ms1060 KiB
20Wrong answer0/341ms1080 KiB
21Wrong answer0/339ms1028 KiB
22Wrong answer0/339ms1080 KiB