Submission #382151

# Submission time Handle Problem Language Result Execution time Memory
382151 2021-03-26T15:26:39 Z fadi57 Monthly railway pass (LMIO18_menesinis_bilietas) C++14
0 / 100
584 ms 82844 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
const ll mx=1e6+10;
const int mod= 1e9+7 ;
const ll inf=1e18;



//***while there is life there is hope


//int a[mx];
int n,m;
vector<pair<int,int>>adj[mx];
int vis[mx];
int dfs(int i,int par){

    vis[i]=1;
    for(auto it:adj[i]){
        if(it.first==par||vis[it.first]){continue;}
        dfs(it.first,i);
    }


}
int ist(char x){
return (x=='A');

}
int main() {
cin>>n>>m;

for(int i=0;i<m;i++){
int x,y;char t;
cin>>x>>y>>t;

    adj[x].push_back({y,ist(t)});
       adj[y].push_back({x,ist(t)});

}
dfs(1,-1);
int ok;
for(int i=1;i<=n;i++){
    if(vis[i]==0){ok=0;}
}
if(ok){
    cout<<n;
}else{
cout<<0;
}

}

Compilation message

menesinis_bilietas.cpp: In function 'int dfs(int, int)':
menesinis_bilietas.cpp:27:1: warning: no return statement in function returning non-void [-Wreturn-type]
   27 | }
      | ^
# Verdict Execution time Memory Grader output
1 Runtime error 584 ms 82844 KB Execution killed with signal 11
# Verdict Execution time Memory Grader output
1 Runtime error 50 ms 47980 KB Execution killed with signal 11
# Verdict Execution time Memory Grader output
1 Runtime error 44 ms 47980 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 44 ms 47980 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 44 ms 47980 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -