57042023-09-09 17:54:25TomaSajtNegáló rendezés (55 pont)cpp17Accepted 55/5557ms14480 KiB
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;

int main() {
  cin.tie(0), ios::sync_with_stdio(0);
  int n;
  cin >> n;
  map<int, int> cnts;
  while (n--) {
    int a;
    cin >> a;
    cnts[a]++;
  }
  cnts.erase(cnts.begin());  // don't use the lowest number, as it will alway be next to its negative version after sorting
  long long res = 1;
  for (auto& [x, c] : cnts) {
    res *= c + 1;  // we can select 0 to c instances of a number to be negative, thus having c+1 options
    res %= mod;
  }
  cout << res;
}
SubtaskSumTestVerdictTimeMemory
base55/55
1Accepted0/03ms1832 KiB
2Accepted0/039ms6080 KiB
3Accepted2/23ms2672 KiB
4Accepted2/23ms2896 KiB
5Accepted2/23ms3132 KiB
6Accepted2/23ms3344 KiB
7Accepted3/33ms3560 KiB
8Accepted2/22ms3652 KiB
9Accepted3/33ms3716 KiB
10Accepted3/350ms12636 KiB
11Accepted3/357ms14480 KiB
12Accepted3/314ms5852 KiB
13Accepted3/314ms6332 KiB
14Accepted3/329ms8828 KiB
15Accepted3/323ms8012 KiB
16Accepted3/339ms11956 KiB
17Accepted3/339ms13164 KiB
18Accepted3/327ms10836 KiB
19Accepted3/339ms13564 KiB
20Accepted3/332ms13044 KiB
21Accepted3/327ms12688 KiB
22Accepted3/319ms12524 KiB