Submission #780838

# Submission time Handle Problem Language Result Execution time Memory
780838 2023-07-12T13:47:23 Z borisAngelov Sifra (COCI21_sifra) C++17
50 / 50
3 ms 320 KB
#include <bits/stdc++.h>

using namespace std;

void fastIO()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

int main()
{
    fastIO();

    string s;
    cin >> s;

    unordered_set<int> uniq;

    int curr = 0;

    for (int i = 0; i < s.size(); ++i)
    {
        if ('a' <= s[i] && s[i] <= 'z')
        {
            continue;
        }

        curr = curr * 10 + (s[i] - '0');

        if (i == s.size() - 1 || ('a' <= s[i + 1] && s[i + 1] <= 'z'))
        {
            uniq.insert(curr);
            curr = 0;
        }
    }

    cout << uniq.size() << endl;

    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:23:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |     for (int i = 0; i < s.size(); ++i)
      |                     ~~^~~~~~~~~~
Main.cpp:32:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   32 |         if (i == s.size() - 1 || ('a' <= s[i + 1] && s[i + 1] <= 'z'))
      |             ~~^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 316 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct