Submission #453647

# Submission time Handle Problem Language Result Execution time Memory
453647 2021-08-04T13:40:58 Z Jokubas Fire drill (LMIO18_sauga) C++14
16.8805 / 100
186 ms 7200 KB
#include <iostream>
#include <bits/stdc++.h>
#define pb push_back

using namespace std;

/*void setIO(string s)
{
    freopen((s + ".in").c_str(), "r", stdin);
}*/

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(nullptr);
    //setIO("input");

    int T, N, S;
    cin>>T>>N>>S;

    int kiek[N+1] = {0};
    vector<int> listas[N+1];

    priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> eil;

    for(int i = 1; i<=N; i++)
    {
        int M;
        cin>>M;
        int a;
        int b = 0;
        for(int j = 0; j<M; j++)
        {
            cin>>a;
            kiek[a]++;
            listas[i].pb(a);
        }

    }
    for(int i = 1; i<=N; i++)
    {
        eil.push(make_pair(kiek[i], i));
    }

    /*0 4 1
    2 2 3
    0
    1 4
    1 1*/


    map<int, bool> istrinti;

    while(!eil.empty())
    {
        int a = eil.top().second;
        eil.pop();
        if(!istrinti.count(a))
        {
            for(auto c : listas[a])
            {
                kiek[c]--;
                if(!istrinti.count(c))
                {
                    eil.push(make_pair(kiek[c], c));
                }
            }
            istrinti[a] = 1;
            cout<<a<<"\n";
        }
    }





    return 0;
}

Compilation message

sauga.cpp: In function 'int main()':
sauga.cpp:30:13: warning: unused variable 'b' [-Wunused-variable]
   30 |         int b = 0;
      |             ^
# Verdict Execution time Memory Grader output
1 Incorrect 186 ms 7200 KB Output isn't correct
2 Partially correct 2 ms 332 KB Output is partially correct
3 Partially correct 2 ms 332 KB Output is partially correct
4 Partially correct 3 ms 460 KB Output is partially correct
5 Partially correct 3 ms 332 KB Output is partially correct
6 Partially correct 4 ms 460 KB Output is partially correct
7 Partially correct 29 ms 1860 KB Output is partially correct
8 Incorrect 150 ms 6964 KB Output isn't correct
9 Partially correct 20 ms 1236 KB Output is partially correct
10 Partially correct 2 ms 332 KB Output is partially correct