4285 2023. 03. 22 09:32:39 tamasmark Testnevelés óra cpp17 Hibás válasz 0/50 209ms 28140 KiB
// torne ora.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>
#include <vector>
#include <algorithm>
#include <deque>
#define ll long long

using namespace std;

struct adat
{
    ll db,szam;
    vector<ll>sz;
};
ll n, k, i,a,b;
bool t,p;
int hasonlit(adat a, adat b)
{
    t = false;
    p = false;
    if (a.db > b.db) return 1;
    else if (a.db == b.db)
    {
        for (auto& e : a.sz)
            if (e == b.szam) t = true;
        for (auto& e : b.sz)
            if (e == a.szam) p = true;
        if (t) return 0;
        else if (p) return 1;
    }
    else return 0;
}
int main()
{
    cin >> n >> k;
    deque<adat>x(n + 1);
    for (i = 1; i <= k; ++i)
    {
        cin >> a >> b;
        x[b].sz.push_back(a);
        x[a].db++;
        x[a].szam = a;
        x[b].szam = b;
    }
    x.pop_front();
    sort(x.begin(), x.end(), hasonlit);
    for (auto& e : x) cout << e.szam << " ";
    return 0;
}
/*
5 9
3 1
3 5
3 4
4 2
3 2
1 4
1 2
1 5
5 4


*/
// 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 0/50
1 Hibás válasz 0/0 3ms 1876 KiB
2 Futási hiba 0/0 3ms 2200 KiB
3 Futási hiba 0/0 162ms 17256 KiB
4 Hibás válasz 0/2 3ms 2560 KiB
5 Futási hiba 0/3 3ms 2860 KiB
6 Hibás válasz 0/3 2ms 2920 KiB
7 Futási hiba 0/3 3ms 3124 KiB
8 Hibás válasz 0/1 3ms 3184 KiB
9 Hibás válasz 0/3 3ms 3340 KiB
10 Futási hiba 0/3 4ms 3584 KiB
11 Futási hiba 0/3 4ms 3664 KiB
12 Futási hiba 0/1 4ms 3600 KiB
13 Futási hiba 0/2 4ms 3600 KiB
14 Futási hiba 0/3 3ms 3848 KiB
15 Futási hiba 0/1 204ms 14268 KiB
16 Futási hiba 0/3 104ms 19440 KiB
17 Futási hiba 0/5 8ms 20344 KiB
18 Futási hiba 0/1 172ms 28140 KiB
19 Futási hiba 0/2 209ms 14916 KiB
20 Futási hiba 0/3 129ms 25912 KiB
21 Futási hiba 0/4 128ms 26168 KiB
22 Futási hiba 0/4 148ms 26072 KiB