This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 (is1)
{
cout << N << '\n';
return 0;
}
else if (is2)
{
for (int i = 0; i < N; i++)
{
if ((int)adjlist[i].size() == N - 1)
ans++;
}
cout << ans << '\n';
return 0;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |