Submission #1021708

#TimeUsernameProblemLanguageResultExecution timeMemory
1021708lHogMonthly railway pass (LMIO18_menesinis_bilietas)C++17
0 / 100
3053 ms26456 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double ld; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef vector<int> veci; typedef vector<ll> vecll; #define mp make_pair #define fi first #define se second // debug needs a semicolon !!! #define debug(x) cerr<<# x<<" is "<<x<<'\n' #define vec vector int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, m; cin >> n >> m; veci a[n]; for (int i=0; i<n; i++) { int x; cin >> x; a[i].push_back(x); char USELESS; cin >> USELESS; } queue<int> tv; tv.push(0); bool visited[n]={1}; while (!tv.empty()) { int x = tv.front(); tv.pop(); for (int i=0; i<a[x].size(); i++) { if (!visited[a[x][i]]) { tv.push(i); } } } for (int i=0; i<n; i++) { if (!visited[i]) { cout << 0; return 0; } } cout << n; return 0; }

Compilation message (stderr)

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