4078 2023. 03. 13 08:37:24 tamasmark Negáló rendezés (55 pont) cpp17 Elfogadva 55/55 37ms 7540 KiB
// bgalo rendezes.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <climits>

using namespace std;

long long y[100000],sum;
vector<long long>x;
int i, n,db,maxi,mini,a;

int main()
{
    cin >> n;
    x.resize(n + 1);
    mini = INT_MAX;
    maxi = INT_MIN;
    for (i = 1; i <= n; ++i)
    {
        cin >> x[i];
        y[x[i]]++;
        a = x[i];
        maxi = max(maxi, a);
        mini = min(mini, a);
    }
    db = 1;
    for (i = mini; i <= maxi; ++i)
    {
        if (y[i]!=0)
        {
            if (db == 1)
            {
                sum = 1;
                db++;
            }
            else
            {
                sum = sum * (y[i] + 1)%1000000007;
            }
        }
    }
    cout << sum;
    return 0;
}
/*
5
5 1 2 3 2
*/
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
Részfeladat Összpont Teszt Verdikt Idő Memória
base 55/55
1 Elfogadva 0/0 3ms 1888 KiB
2 Elfogadva 0/0 35ms 5112 KiB
3 Elfogadva 2/2 3ms 2676 KiB
4 Elfogadva 2/2 3ms 2596 KiB
5 Elfogadva 2/2 3ms 2676 KiB
6 Elfogadva 2/2 3ms 2680 KiB
7 Elfogadva 3/3 3ms 3040 KiB
8 Elfogadva 2/2 3ms 3472 KiB
9 Elfogadva 3/3 4ms 4888 KiB
10 Elfogadva 3/3 32ms 6328 KiB
11 Elfogadva 3/3 35ms 6408 KiB
12 Elfogadva 3/3 35ms 5108 KiB
13 Elfogadva 3/3 34ms 5256 KiB
14 Elfogadva 3/3 35ms 6596 KiB
15 Elfogadva 3/3 35ms 6596 KiB
16 Elfogadva 3/3 37ms 6852 KiB
17 Elfogadva 3/3 34ms 6924 KiB
18 Elfogadva 3/3 35ms 7280 KiB
19 Elfogadva 3/3 35ms 7396 KiB
20 Elfogadva 3/3 35ms 7340 KiB
21 Elfogadva 3/3 32ms 7416 KiB
22 Elfogadva 3/3 35ms 7540 KiB