30772023-02-14 12:01:28tamasmarkKéséscpp17Futási hiba 0/50231ms223508 KiB
// keses.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

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

using namespace std;

struct adat
{
   unsigned long long db, pillanat;
};

unsigned long long n, i, mini,maxi,keses;
vector< unsigned long long>x;
vector<adat>y;

int main()
{
    cin >> n;
    x.resize(n + 1);
    y.resize(9999999);
    for (i = 1; i <= n; ++i)
    {
        cin >> x[i];
        if (x[i] < mini) mini = x[i];
        if (x[i] > maxi) maxi = x[i];
        if (!y[x[i]].db)
        {
            y[x[i]].db++;
            y[x[i]].pillanat = i;
        }
        else
        {
            if (y[x[i]].pillanat < i) y[x[i]].pillanat = i;
        }
    }
    keses = LLONG_MAX;
    for (i = mini; i <= maxi; ++i)
    {
        if (y[i].db)
        {
            if (y[i].pillanat < keses) keses = y[i].pillanat;
        }
    }
    cout << keses;
    return 0;
}
/*
6
1848 1849 1848 1849 895 1516
*/
// 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
base0/50
1Elfogadva0/0231ms223508 KiB
2Futási hiba0/061ms131848 KiB
3Futási hiba0/559ms131612 KiB
4Futási hiba0/548ms131372 KiB
5Futási hiba0/550ms131116 KiB
6Futási hiba0/550ms130876 KiB
7Futási hiba0/448ms130644 KiB
8Futási hiba0/448ms130408 KiB
9Futási hiba0/456ms130176 KiB
10Futási hiba0/456ms130064 KiB
11Futási hiba0/448ms130060 KiB
12Futási hiba0/248ms129816 KiB
13Futási hiba0/257ms129656 KiB
14Futási hiba0/157ms129456 KiB
15Futási hiba0/157ms129228 KiB
16Futási hiba0/148ms129000 KiB
17Futási hiba0/148ms128768 KiB
18Futási hiba0/157ms128780 KiB
19Futási hiba0/157ms128780 KiB