답안 #283484

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
283484 2020-08-25T20:20:02 Z infinite_iq Potemkin cycle (CEOI15_indcyc) C++14
60 / 100
478 ms 5296 KB
#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#include <bits/stdc++.h>
using namespace std;
#define sqr 340
#define mp make_pair
#define mid (l+r)/2
#define le node * 2 
#define ri node * 2 + 1 
#define pb push_back
#define ppb pop_back
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define ins insert
#define era erase
#define C continue
#define mem(dp,i) memset(dp,i,sizeof(dp))
#define mset multiset
#define all(x) x.begin(), x.end()
#define gc getchar_unlocked
typedef long long ll;
typedef short int si;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
typedef pair<double,ll>pdi;
const ll inf=1e18;
const ll mod=998244353;
const ld Pi=acos(-1) ;
int n , m ;
vi v [1009] , ans ;
int done [1009] , in [1009] , go [1009][1009] ;
void dfs ( int node , int p ) {
        ans .pb ( node ) ;
        done [node] = 1 ;
        in   [node] = 1 ;
        for ( int i = (int) ans . size () - 3 ; i >= 0 ; i -- ) {
                if ( go [ans[i]][node] ) {
                        for ( int j = i ; j < ans . size () ; j ++ ) {
                                cout << ans [j] + 1 << " " ;
                        }
                        cout << endl ;
                        exit (0) ;
                }
        }
        for ( auto u : v [node] ) {
                if ( done [u] ) C ;
                if ( p != -1 && go [u][p] ) C ;
                dfs ( u , node ) ;
        }
        in  [node] = 0 ;
        ans .pop_back () ;
}
int main () {
        cin >> n >> m ;
        for ( int i = 0 ; i < m ; i ++ ) {
                int a , b ;
                cin >> a >> b ;
                a -- , b -- ;
                v [a] .pb ( b ) ;
                v [b] .pb ( a ) ;
                go [a][b] = go [b][a] = 1 ;
        }
        for ( int i = 0 ; i < n ; i ++ ) {
                mem ( done , 0 ) ;
                dfs ( 0 , -1 ) ;
        }
        cout << "no" << endl ;
}

Compilation message

indcyc.cpp: In function 'void dfs(int, int)':
indcyc.cpp:44:45: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |                         for ( int j = i ; j < ans . size () ; j ++ ) {
      |                                           ~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 1 ms 384 KB Output is correct
4 Correct 0 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 768 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 768 KB Expected integer, but "no" found
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 1664 KB Output is correct
2 Correct 5 ms 1664 KB Output is correct
3 Correct 6 ms 1664 KB Output is correct
4 Correct 22 ms 1664 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 1664 KB Expected integer, but "no" found
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 46 ms 5240 KB Output is correct
2 Correct 22 ms 4736 KB Output is correct
3 Correct 478 ms 5296 KB Output is correct
4 Correct 260 ms 4736 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 198 ms 4760 KB Expected integer, but "no" found
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 303 ms 3704 KB Expected integer, but "no" found
2 Halted 0 ms 0 KB -