제출 #639616

#제출 시각아이디문제언어결과실행 시간메모리
639616teeslaMonthly railway pass (LMIO18_menesinis_bilietas)C++14
10 / 100
477 ms30668 KiB
#include <bits/stdc++.h> using namespace std; const int maxn=5*1e5+10; int n,m; vector<int> adj[maxn]; int visitado[maxn]; void dfs(int x){ visitado[x]=1; for(int i=0; i<adj[x].size(); i++){ int viz=adj[x][i]; if(visitado[viz]==1)continue; dfs(viz); } return; } int main(){ cin >> n>> m; for(int i=0; i<m; i++){ int a,b; char c; cin >> a >> b >> c; adj[a].push_back(b); adj[b].push_back(a); } dfs(1); int res=n; for(int i=1; i<=n; i++) if(visitado[i]==0) res=0; cout << res<<endl; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

menesinis_bilietas.cpp: In function 'void dfs(int)':
menesinis_bilietas.cpp:10:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   10 |  for(int i=0; i<adj[x].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...