76112024-01-10 09:05:35gyjazminNegáló rendezés (55 pont)cpp17Time limit exceeded 14/55300ms4332 KiB

#include <map>
#include <iostream>
#include <vector>
using namespace std;
vector<pair<int, int>> sz;
bool vanbenne(int a) {
    bool vb = false;
    for (int i = 0;i < sz.size();i++) {
        if (sz[i].first == a) {
            vb= true;
        }
    }
    return vb;
}
int megtalal(int a) {
    for (int i = 0;i < sz.size();i++) {
        if (sz[i].first == a) {
            return i;
        }
    }
}
int main()
{
    int n;
    cin >> n;
    int legkisebb = 100001;
    for (int i = 0;i < n;i++) {
        int a;
        cin >> a;
        if (!vanbenne(a)) {
            sz.push_back({a, 0});
        }
        sz[megtalal(a)].second++;
        if (a < legkisebb) {
            legkisebb = a;
        }
    }
    long long valasz=1;
    for (int i = 0;i < sz.size();i++) {
        if (sz[i].first != legkisebb) {
            valasz = valasz * (sz[i].second + 1);
        }
    }
    cout << valasz << endl;
}
SubtaskSumTestVerdictTimeMemory
base14/55
1Accepted0/03ms1752 KiB
2Time limit exceeded0/0300ms1432 KiB
3Accepted2/23ms2120 KiB
4Accepted2/23ms2372 KiB
5Accepted2/23ms2580 KiB
6Accepted2/23ms2756 KiB
7Accepted3/33ms2972 KiB
8Wrong answer0/23ms3056 KiB
9Wrong answer0/34ms3208 KiB
10Time limit exceeded0/3270ms2936 KiB
11Time limit exceeded0/3250ms3012 KiB
12Accepted3/335ms3560 KiB
13Wrong answer0/332ms3560 KiB
14Time limit exceeded0/3263ms3080 KiB
15Wrong answer0/3156ms3836 KiB
16Time limit exceeded0/3268ms3428 KiB
17Time limit exceeded0/3275ms3556 KiB
18Time limit exceeded0/3261ms3708 KiB
19Time limit exceeded0/3257ms3968 KiB
20Time limit exceeded0/3261ms3652 KiB
21Time limit exceeded0/3241ms3636 KiB
22Wrong answer0/382ms4332 KiB