Submission #994043


Source Code Expand

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <queue>
#include <map>

typedef long long ll;
#define rep(i, b) for(int i = 0; i < b; i++)
#define repi(i, a, b) for(int i = a; i < b; i++)
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define MAX_V 1001
#define MAX_E 401
#define MOD 1000000007
#define EPS 1e-7
#define INF INT_MAX
#define PI  3.14159265358979323846264338327950288
inline ll toll(std::string s) { ll v; std::istringstream sin(s); sin >> v; return v; }
template<class T> inline std::string toString(T x) { std::ostringstream sout; sout << x; return sout.str(); }
using namespace std;
typedef pair<ll, ll> pll;

int ma[100002][100002];

int check[10002];

int main()
{
    int N,M;
    cin >> N >> M;
    vector<int> K(N);
    vector< vector<int> > T(N);
    rep(i,100002)
    {
        rep(j,100002)
        {
            ma[i][j] = 0;
        }
    }
    
    rep(i,N)
    {
        cin >> K[i];
        rep(j,K[i])
        {
            int L;
            cin >> L;
            ma[i][L - 1] = 1;
            T[i].push_back(L - 1);
        }
    }
    
    queue<int> que;
    que.push(0);
    check[0] = 1;
    while ( !que.empty() )
    {
        const ll cur = que.front();
        que.pop();
        
        rep(i,K[cur])
        {
            rep(j,N)
            {
                if(ma[j][T[cur][i]] == 1 && check[j] == 0)
                {
                    que.push(j);
                    check[j] = 1;
                }
            }
        }
    }
    
    rep(i,N)
    {
        if(check[i] == 0)
        {
            cout << "NO" << endl;
            return 0;
        }
    }
    cout << "YES" << endl;
    return 0;
}

Submission Info

Submission Time
Task C - Interpretation
User otofu
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1952 Byte
Status CE

Compile Error

/tmp/ccREHeup.o: In function `_GLOBAL__sub_I_ma':
Main.cpp:(.text.startup+0x6f5): relocation truncated to fit: R_X86_64_32 against `.bss'
Main.cpp:(.text.startup+0x704): relocation truncated to fit: R_X86_64_32 against `.bss'
collect2: error: ld returned 1 exit status