Submission #128343

#TimeUsernameProblemLanguageResultExecution timeMemory
128343Harry464Wand (COCI19_wand)C++14
63 / 70
134 ms5956 KiB
#include <iostream> #include <vector> #include <queue> using namespace std; int main() { int n, m; cin >> n >> m; vector <int> red; vector <vector <int> > adjl(n,red); for (int i = 0; i < m; i++){ int u, v; cin >> v >> u; adjl[u-1].push_back(v-1); } queue <int> bfs; bfs.push(0); bool mog = false; vector <bool> vis(n); while (!bfs.empty()){ int s = bfs.front(); bfs.pop(); if (vis[s]) continue; vis[s] = true; for(int i = 0; i < adjl[s].size(); i++){ int t = adjl[s][i]; if (t == 0) mog = true; if (!vis[t]) bfs.push(t); } } if (mog) cout <<"1"; else cout << "0"; for (int i = 1; i < n; i++){ if (vis[i]) cout << "1"; else cout << "0"; } }

Compilation message (stderr)

wand.cpp: In function 'int main()':
wand.cpp:26:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int i = 0; i < adjl[s].size(); i++){
                   ~~^~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...