답안 #215926

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
215926 2020-03-26T12:31:01 Z SamAnd Fire drill (LMIO18_sauga) C++17
57.3246 / 100
69 ms 3064 KB
#include <bits/stdc++.h>
using namespace std;
#define m_p make_pair
const int N = 1003;

mt19937 rnd(3141);

int tt, n, ss;
vector<int> a[N];

vector<int> v;
bool c[N];
void dfs(int x)
{
    c[x] = true;
    for (int i = 0; i < a[x].size(); ++i)
    {
        int h = a[x][i];
        if (!c[h])
            dfs(h);
    }
    v.push_back(x);
}

int main()
{
    scanf("%d%d%d", &tt, &n, &ss);
    for (int i = 1; i <= n; ++i)
    {
        int q;
        scanf("%d", &q);
        while (q--)
        {
            int x;
            scanf("%d", &x);
            a[i].push_back(x);
        }
    }
    for (int i = 1; i <= n; ++i)
    {
        if (!c[i])
            dfs(i);
    }
    for (int i = 0; i < n; ++i)
        printf("%d\n", v[i]);
    return 0;
}

Compilation message

sauga.cpp: In function 'void dfs(int)':
sauga.cpp:16:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 0; i < a[x].size(); ++i)
                     ~~^~~~~~~~~~~~~
sauga.cpp: In function 'int main()':
sauga.cpp:27:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d%d", &tt, &n, &ss);
     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
sauga.cpp:31:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d", &q);
         ~~~~~^~~~~~~~~~
sauga.cpp:35:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
             scanf("%d", &x);
             ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 60 ms 3064 KB Output is correct
2 Partially correct 5 ms 384 KB Output is partially correct
3 Partially correct 5 ms 384 KB Output is partially correct
4 Partially correct 6 ms 384 KB Output is partially correct
5 Partially correct 6 ms 384 KB Output is partially correct
6 Partially correct 6 ms 384 KB Output is partially correct
7 Partially correct 15 ms 768 KB Output is partially correct
8 Partially correct 69 ms 2808 KB Output is partially correct
9 Partially correct 12 ms 640 KB Output is partially correct
10 Correct 5 ms 384 KB Output is correct