Submission #486130

# Submission time Handle Problem Language Result Execution time Memory
486130 2021-11-10T15:18:24 Z davi_bart Sifra (COCI21_sifra) C++14
50 / 50
1 ms 204 KB
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define int ll
#define fi first
#define se second
#define ld long double
#define pb push_back
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    string a;
    cin >> a;
    vector<pair<int, bool> > v(1, {0, 0});
    for (auto x : a) {
        if ('0' <= x && x <= '9') {
            v.back().fi = v.back().fi * 10 + x - '0';
            v.back().se = 1;
        } else {
            if (v.back().se) v.pb({0, 0});
        }
    }
    set<int> s;
    for (auto [a, b] : v) {
        if (b) s.insert(a);
    }
    cout << s.size() << endl;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:26:15: warning: structured bindings only available with '-std=c++17' or '-std=gnu++17'
   26 |     for (auto [a, b] : v) {
      |               ^
# Verdict Execution time Memory Grader output
1 Correct 0 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 1 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