79532024-01-12 08:32:42antiNegáló rendezés (55 pont)cpp17Wrong answer 25/5548ms5824 KiB
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int N;
    cin >> N;
    vector<int> a, b;
    for (int i = 0; i < N; i++) {
        int h;
        cin >> h;
        a.push_back(h);
    }
    
    sort(a.begin(), a.end());

    for (int i = 0; i < N; i++) {
        b.push_back(1);
    }

    int n = 0;
    for (int i = 1; i < N; i++) {
        if (a[i] == a[i - 1]) {
            b[n]++;
        }
        else {
            n++;
        }
    }

    for (int i = n+1; i < N; i++) {
        b[i] = 0;
    }

    int megoldas = 1;
    for (int i = 1; i < N; i++) {
        if (b[i] != 0) {
            megoldas *= b[i] + 1;
            if (megoldas > 1000000007)
                megoldas %= 1000000007;
        }
    }
    cout << megoldas;

    /*for (int i = 0; i < N; i++) {
        cout << b.back() << " ";
        b.pop_back();
    }
    cout << endl;
    for (int i = 0; i < N; i++) {
        cout << a.back() << " ";
        a.pop_back();
    }*/
}

/*
5
5 1 2 3 2

1 2 2 3 5 -> 5 3 2 2 1
1 2 1 1   -> 1 1 2 1
*/
SubtaskSumTestVerdictTimeMemory
base25/55
1Accepted0/03ms2000 KiB
2Wrong answer0/046ms4136 KiB
3Accepted2/23ms2332 KiB
4Accepted2/23ms2464 KiB
5Accepted2/23ms2596 KiB
6Accepted2/23ms2684 KiB
7Accepted3/33ms2676 KiB
8Accepted2/23ms2924 KiB
9Accepted3/33ms3312 KiB
10Accepted3/343ms5304 KiB
11Accepted3/346ms5276 KiB
12Accepted3/339ms5344 KiB
13Wrong answer0/337ms5424 KiB
14Wrong answer0/345ms5424 KiB
15Wrong answer0/343ms5308 KiB
16Wrong answer0/348ms5384 KiB
17Wrong answer0/343ms5540 KiB
18Wrong answer0/345ms5552 KiB
19Wrong answer0/346ms5648 KiB
20Wrong answer0/345ms5748 KiB
21Wrong answer0/341ms5692 KiB
22Wrong answer0/343ms5824 KiB