Submission #475104

# Submission time Handle Problem Language Result Execution time Memory
475104 2021-09-21T08:04:51 Z HossamHero7 Sifra (COCI21_sifra) C++14
50 / 50
1 ms 204 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
#define endl '\n'
void solve(){
    string s;
    cin>>s;
    s += 'z';
    int n = s.size();
    ll ans = 0;
    ll x = 0;
    map <int,bool> mp;
    bool m = 0;
    for(int i=0;i<n;i++){
        if(s[i] >= '0' && s[i] <= '9'){
            x *= 10;
            x += s[i]-48;
            m = 1;
        }
        else if(m){
            m = 0;
            if(!mp[x]){
                ans ++;
            }
            mp[x] = 1;
            x = 0;
        }
    }
    cout<<ans<<endl;
}
int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);      cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct