Submission #920861

#TimeUsernameProblemLanguageResultExecution timeMemory
920861gelastropodMonthly railway pass (LMIO18_menesinis_bilietas)C++14
0 / 100
311 ms22352 KiB
#include <bits/stdc++.h> using namespace std; #define int long long signed main() { int N, M, a, b, ans = 0; cin >> N >> M; char t; bool is1 = true, is2 = true; vector<vector<int>> adjlist(N, vector<int>()); for (int i = 0; i < M; i++) { cin >> a >> b >> t; a--, b--; adjlist[a].push_back(b); adjlist[b].push_back(a); if (t == 'A') is1 = false; if (t == 'T') is2 = false; } if (is2) { cout << N << '\n'; return 0; } else if (is1) { for (int i = 0; i < N; i++) { if ((int)adjlist[i].size() == N - 1) ans++; } cout << ans << '\n'; return 0; } }
#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...