Submission #920856

# Submission time Handle Problem Language Result Execution time Memory
920856 2024-02-03T06:34:45 Z gelastropod Monthly railway pass (LMIO18_menesinis_bilietas) C++14
0 / 100
380 ms 29104 KB
#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 < M; i++)
        {
            if (adjlist[i].size() == N - 1)
                ans++;
        }
        cout << ans << '\n';
        return 0;
    }
}

Compilation message

menesinis_bilietas.cpp: In function 'int main()':
menesinis_bilietas.cpp:30:35: warning: comparison of integer expressions of different signedness: 'std::vector<long long int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   30 |             if (adjlist[i].size() == N - 1)
      |                 ~~~~~~~~~~~~~~~~~~^~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 380 ms 29104 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 11352 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 1 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 380 ms 29104 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -