| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 50076 | chonka | Alkemija (COCI18_alkemija) | C++98 | 92 ms | 17368 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<iostream>
#include<stdio.h>
#include<queue>
using namespace std ;
#define MAXN 100007
int n , m ;
bool fl[ MAXN ] ;
vector < int > v[ MAXN ] ;
int lft[ MAXN ] ;
vector < int > aux[ MAXN ] ;
void input ( ) {
    int k ;
    scanf ( "%d%d" , &n , &k ) ;
    int i , j ;
    while ( k -- ) {
        int x ;
        scanf ( "%d" , &x ) ;
        fl[ x ] = true ;
    }
    scanf ( "%d" , &m ) ;
    for ( i = 1 ; i <= m ; i ++ ) {
        int sz1 , sz2 ;
        scanf ( "%d%d" , &sz1 , &sz2 ) ;
        for ( j = 0 ; j < sz1 ; j ++ ) {
            int x ;
            scanf ( "%d" , &x ) ;
            if ( fl[ x ] == false ) { lft[ i ] ++ ; v[ x ].push_back ( i ) ; }
        }
        for ( j = 0 ; j < sz2 ; j ++ ) {
            int x ;
            scanf ( "%d" , &x ) ;
            aux[ i ].push_back ( x ) ;
        }
    }
}
void solve ( ) {
    queue < int > q ;
    while ( q.empty ( ) == false ) { q.pop ( ) ; }
    int i , j ;
    for ( i = 1 ; i <= m ; i ++ ) {
        if ( lft[ i ] == 0 ) { q.push ( i ) ; lft[ i ] = -1 ; }
    }
    while ( q.empty ( ) == false ) {
        int x = q.front ( ) ;
        q.pop ( ) ;
        int sz = aux[ x ].size ( ) ;
        for ( i = 0 ; i < sz ; i ++ ) {
            if ( fl[ aux[ x ][ i ] ] == false ) {
                fl[ aux[ x ][ i ] ] = true ;
                int g = v[ aux[ x ][ i ] ].size ( ) ;
                for ( j = 0 ; j < g ; j ++ ) {
                    int h = v[ aux[ x ][ i ] ][ j ] ;
                    lft[ h ] -- ;
                    if ( lft[ h ] == 0 ) {
                        lft[ h ] = -1 ;
                        q.push ( h ) ;
                    }
                }
            }
        }
    }
    int ans = 0 ;
    for ( i = 1 ; i <= n ; i ++ ) {
        ans += fl[ i ] ;
    }
    printf ( "%d\n" , ans ) ;
    for ( i = 1 ; i <= n ; i ++ ) {
        if ( fl[ i ] == true ) { printf ( "%d " , i ) ; }
    }
    printf ( "\n" ) ;
}
int main ( ) {
    input ( ) ;
    solve ( ) ;
    return 0 ;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
