Submission #37478

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
374782017-12-25 18:23:19mohammad_kilaniPipes (CEOI15_pipes)C++14
100 / 100
1361 ms8852 KiB
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
#define oo 2000000000
const int N = 100010;
int n, m , cnt = 0 , dsu[N] , dsu2[N] , comp[N] , u , v , a ,b , depth[N] , qu[N], st , en, node;
bitset < N > bridge;
vector< pair<int,int> > g[N];
pair<int,int> parent[N];
inline int find(int u){ return (u == dsu[u] ? u : dsu[u] = find(dsu[u]));}
inline int find2(int u){ return (u == dsu2[u] ? u : dsu2[u] = find2(dsu2[u]));}
inline int get(int node1,int node2){
if(node1 == node2) return find2(node1);
if(depth[node1] > depth[node2]){
bridge[parent[node1].second] = false;
return dsu2[node1] = dsu2[node2] = get(find2(parent[node1].first),node2);
}
bridge[parent[node2].second] = false;
return dsu2[node1] = dsu2[node2] = get(node1,find2(parent[node2].first));
}
int main() {
scanf("%d%d",&n,&m);
for(int i=1;i<=n;i++) dsu[i] = dsu2[i] = i , comp[i] = 1;
for(int i=0;i<m;i++){
scanf("%d%d",&u,&v);
a = find(u);
b = find(v);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

pipes.cpp: In function 'int main()':
pipes.cpp:46:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0;i<g[node].size();i++){
                 ~^~~~~~~~~~~~~~~
pipes.cpp:62:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int j=0;j<g[i].size();j++){
               ~^~~~~~~~~~~~
pipes.cpp:25:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&n,&m);
  ~~~~~^~~~~~~~~~~~~~
pipes.cpp:28:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d%d",&u,&v);
   ~~~~~^~~~~~~~~~~~~~
#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...