Submission #1069121

#TimeUsernameProblemLanguageResultExecution timeMemory
1069121vjudge1Pipes (CEOI15_pipes)C++17
0 / 100
2147 ms65536 KiB
#include<bits/stdc++.h> using namespace std; typedef pair<int, int> ii; typedef long long ll; typedef pair<long long, long long> pll; typedef pair<char, int> ci; typedef pair<string, int> si; typedef long double ld; typedef vector<int> vi; typedef vector<string> vs; #define pb push_back #define fi first #define se second #define whole(v) v.begin(), v.end() #define rwhole(v) v.rbegin(), v.rend() #define inf INT_MAX/2 #define fro front vector<vector<ii>> x(105); int vis[105]; int hi[105]; int dp[105]; int bridges[105]; int dfs(int n, int h, int idxeje){ vis[n] = 1; hi[n] = h; dp[n] = h; for(auto e:x[n]){ if(e.se == idxeje)continue; int nxt = e.fi; if(vis[nxt] == 2){ continue; } if(vis[nxt] == 1){ dp[n] = min(dp[nxt], dp[n]); continue; } int k = dfs(e.fi, h+1, e.se); dp[n] = min(k, dp[n]); } if(idxeje == -1){ return dp[n]; } if(dp[n] >= h){ bridges[idxeje] = 1; } vis[n] = 2; return dp[n]; } int main(){ ios_base::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m; vector<ii> d(m); for(int i = 0; i < m; ++i){ int y, z; cin >> y >> z; x[y].pb(ii(z, i)); x[z].pb(ii(y, i)); d[i] = ii(y, z); } for(int i = 1; i <= n; ++i){ hi[i] = inf; } for(int i = 1; i <= n; ++i){ if(vis[i] == 0){ dfs(i, 0, -1); hi[i] = 0; } } for(int i = 0; i < d.size(); ++i){ if(bridges[i] == 1){ cout << d[i].fi << " " << d[i].se << endl; } } }

Compilation message (stderr)

pipes.cpp: In function 'int main()':
pipes.cpp:74:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   74 |     for(int i = 0; i < d.size(); ++i){
      |                    ~~^~~~~~~~~~
#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...