Submission #366345

# Submission time Handle Problem Language Result Execution time Memory
366345 2021-02-14T03:34:06 Z arujbansal Sifra (COCI21_sifra) C++17
50 / 50
1 ms 384 KB
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <array>
#include <stack>
#include <queue>
#include <random>
#include <numeric>
#include <chrono>
#include <utility>
#include <iomanip>
#include <assert.h>

using namespace std;

void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail>
void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)

#define rng_init mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define rng_seed(x) mt19937 rng(x)
#define all(x) (x).begin(), (x).end()
#define sz(x) (int) (x).size()
// #define int long long

const int MXN = 1e5 + 1, INF = 1e9 + 1;

void solve() {
    string S;
    cin >> S;

    int N = sz(S);

    set<string> st;

    for (int i = 0, j = 0; i < N; i++) {
        if (!(S[i] >= '0' && S[i] <= '9'))
            continue;
        
        string num;
        for (j = i; j < N && (S[j] >= '0') && (S[j] <= '9'); j++)
            num += S[j];

        i = j - 1;

        if (sz(num) > 0)
            st.insert(num);
    }

    cout << sz(st);
}

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int TC = 1;
    // cin >> TC;
    while (TC--) solve();
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 0 ms 364 KB Output is correct