40782023-03-13 08:37:24tamasmarkNegáló rendezés (55 pont)cpp17Elfogadva 55/5537ms7540 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ÖsszpontTesztVerdiktIdőMemória
base55/55
1Elfogadva0/03ms1888 KiB
2Elfogadva0/035ms5112 KiB
3Elfogadva2/23ms2676 KiB
4Elfogadva2/23ms2596 KiB
5Elfogadva2/23ms2676 KiB
6Elfogadva2/23ms2680 KiB
7Elfogadva3/33ms3040 KiB
8Elfogadva2/23ms3472 KiB
9Elfogadva3/34ms4888 KiB
10Elfogadva3/332ms6328 KiB
11Elfogadva3/335ms6408 KiB
12Elfogadva3/335ms5108 KiB
13Elfogadva3/334ms5256 KiB
14Elfogadva3/335ms6596 KiB
15Elfogadva3/335ms6596 KiB
16Elfogadva3/337ms6852 KiB
17Elfogadva3/334ms6924 KiB
18Elfogadva3/335ms7280 KiB
19Elfogadva3/335ms7396 KiB
20Elfogadva3/335ms7340 KiB
21Elfogadva3/332ms7416 KiB
22Elfogadva3/335ms7540 KiB