114792024-10-06 15:04:53benedekmartonPletykacpp14Wrong answer 0/1003ms632 KiB
#include <iostream>
#include <set>
#include <vector>
#include <fstream>

using namespace std;

int main()
{
    ifstream cin("be2.txt");
    ofstream cout("ki.txt");
    int n, m, k, egydiak, megegy, p=1; cin >> n >> m >> k;
    set <int> akitudja;
    for (int i = 0; i < k; i++)
    {
        cin >> egydiak;
        akitudja.insert(egydiak);
    }
    vector <int> baratai[n+1]; //ide n+1 kell
    for (int i = 0; i < m; i++)
    {
        cin >> egydiak >> megegy;
        baratai[egydiak].push_back(megegy);
        baratai[megegy].push_back(egydiak);
    }
    int pmax = 1, maxi = k;
    set <int> ujakitudja;
    vector <int> hanyantudjak;
    hanyantudjak.push_back(akitudja.size());
    while (p<300) //ez random
    {
        for (auto& i : akitudja)
        {
            for (int j = 0; j < baratai[i].size(); j++)
            {
                ujakitudja.insert(baratai[i][j]);
            }
        }
        akitudja.clear();
        for (auto& i : ujakitudja)
        {
            akitudja.insert(i);
        }
        ujakitudja.clear();
        hanyantudjak.push_back(akitudja.size());
        //cout << akitudja.size() << " ";
        p++;
        if (maxi < akitudja.size())
        {
            maxi = akitudja.size();
            pmax = p;
        }
    }
    cout << maxi << endl << pmax << endl;
    for (int i = 0; i < pmax; i++)
    {
        cout << hanyantudjak[i] << " ";
    }

    
}

SubtaskSumTestVerdictTimeMemory
base0/100
1Wrong answer0/03ms396 KiB
2Wrong answer0/03ms504 KiB
3Wrong answer0/23ms608 KiB
4Wrong answer0/23ms400 KiB
5Wrong answer0/22ms504 KiB
6Wrong answer0/23ms360 KiB
7Wrong answer0/43ms632 KiB
8Wrong answer0/43ms360 KiB
9Wrong answer0/42ms360 KiB
10Wrong answer0/43ms504 KiB
11Wrong answer0/42ms360 KiB
12Wrong answer0/43ms360 KiB
13Wrong answer0/42ms364 KiB
14Wrong answer0/43ms496 KiB
15Wrong answer0/62ms360 KiB
16Wrong answer0/63ms504 KiB
17Wrong answer0/63ms376 KiB
18Wrong answer0/63ms360 KiB
19Wrong answer0/63ms496 KiB
20Wrong answer0/63ms400 KiB
21Wrong answer0/63ms504 KiB
22Wrong answer0/62ms360 KiB
23Wrong answer0/63ms396 KiB
24Wrong answer0/63ms528 KiB