76092024-01-10 09:01:08gyjazminNegáló rendezés (55 pont)cpp17Time limit exceeded 14/55300ms4020 KiB

#include <map>
#include <iostream>
#include <vector>
using namespace std;
vector<pair<int, int>> sz;
bool vanbenne(int a) {
    for (int i = 0;i < sz.size();i++) {
        if (sz[i].first == a) {
            return true;
        }
    }
    return false;
}
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/03ms1748 KiB
2Time limit exceeded0/0300ms1516 KiB
3Accepted2/23ms2128 KiB
4Accepted2/23ms2376 KiB
5Accepted2/23ms2700 KiB
6Accepted2/23ms2836 KiB
7Accepted3/33ms2916 KiB
8Wrong answer0/23ms2988 KiB
9Wrong answer0/34ms3152 KiB
10Time limit exceeded0/3282ms2680 KiB
11Time limit exceeded0/3273ms2532 KiB
12Accepted3/337ms3148 KiB
13Wrong answer0/335ms3272 KiB
14Time limit exceeded0/3300ms2860 KiB
15Wrong answer0/3104ms3612 KiB
16Time limit exceeded0/3259ms3328 KiB
17Time limit exceeded0/3277ms3300 KiB
18Time limit exceeded0/3277ms3300 KiB
19Time limit exceeded0/3266ms3580 KiB
20Time limit exceeded0/3250ms3320 KiB
21Time limit exceeded0/3254ms3248 KiB
22Wrong answer0/364ms4020 KiB