Submission #283487

#TimeUsernameProblemLanguageResultExecution timeMemory
283487infinite_iqPotemkin cycle (CEOI15_indcyc)C++14
60 / 100
1089 ms4856 KiB
#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 ) ; 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 ( u == p ) 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 ++ ) { dfs ( 0 , -1 ) ; } cout << "no" << endl ; }

Compilation message (stderr)

indcyc.cpp: In function 'void dfs(int, int)':
indcyc.cpp:43:45: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |                         for ( int j = i ; j < ans . size () ; j ++ ) {
      |                                           ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...