114832024-10-06 15:08:47benedekmartonPletykacpp14Wrong answer 4/100199ms8808 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<100) //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
base4/100
1Accepted0/03ms504 KiB
2Wrong answer0/074ms2156 KiB
3Accepted2/23ms360 KiB
4Accepted2/239ms628 KiB
5Wrong answer0/264ms656 KiB
6Wrong answer0/228ms760 KiB
7Wrong answer0/471ms760 KiB
8Wrong answer0/448ms1008 KiB
9Wrong answer0/464ms1272 KiB
10Wrong answer0/454ms1144 KiB
11Wrong answer0/439ms2168 KiB
12Wrong answer0/493ms2320 KiB
13Wrong answer0/492ms3232 KiB
14Wrong answer0/4119ms3368 KiB
15Time limit exceeded0/6149ms4496 KiB
16Wrong answer0/6107ms4456 KiB
17Time limit exceeded0/6137ms5236 KiB
18Time limit exceeded0/6168ms5608 KiB
19Time limit exceeded0/6189ms5992 KiB
20Time limit exceeded0/6128ms6136 KiB
21Time limit exceeded0/6179ms6248 KiB
22Time limit exceeded0/6195ms6540 KiB
23Time limit exceeded0/6194ms8336 KiB
24Time limit exceeded0/6199ms8808 KiB