Submission #934509

# Submission time Handle Problem Language Result Execution time Memory
934509 2024-02-27T13:26:54 Z Whisper Sifra (COCI21_sifra) C++17
50 / 50
1 ms 600 KB
#include "bits/stdc++.h"

//@Whisper__
#pragma GCC optimize("Ofast")

#define ii pair<int,int>
#define tii tuple<int,int,int>
#define ep emplace
#define pb push_back
#define f first
#define s second
#define all(x) begin(x) , end(x)
#define full(x) x + 1 , x + n + 1

using namespace std;
using ll = long long;
using str = string;
using ld = long double;
using ull = unsigned ll;

const ll P[4] = {'U', 'L', 'R', 'D'};
const ll dx[8] = {-1, -1, 1, 1, 0, 0, -1, 1};
const ll dy[8] = {-1, 1, -1, 1, -1, 1, 0, 0};

const ll L = 1e3 + 5;
const ll LINF = ( 1e18 + 5 );
const ll N = 1e6 + 5;
const int inf = ( 1e9 + 5 );
const int MOD = 1e9 + 7;

template<class T> bool minimum(T& a, const T& b) { return b < a ? a = b, 1 : 0; }
template<class T> bool maximum(T& a, const T& b) { return a < b ? a = b, 1 : 0; }
template<class T> using MaxHeap = priority_queue< T , vector<T> , less<T> >;
template<class T> using MinHeap = priority_queue< T , vector<T> , greater<T> >;
ll n;
ll a[N];
ll d[N];
void run_case(){
	str s; cin >> s;
	ll cnt = 0; 
	for ( int i = 0 ; i < (int)s.size() ; ){
		if ( s[i] >= '0' && s[i] <= '9' ){
			ll num = 0;
			while ( s[i] >= '0' && s[i] <= '9'){
				num = num * 10 + ( s[i] - '0' );
				i++;
			}
			//cout << num << " ";
			if ( !d[num] ){
				d[num] = 1;
				++cnt;	
			}
		}
		i++;
	}
	cout << cnt;
}
signed main(){
    cin.tie(nullptr)->sync_with_stdio(false); cout.tie(nullptr);
    #define TASK "LASTZERO"
//    freopen(TASK".inp","r",stdin);
//    freopen(TASK".out","w",stdout);
    ll Test = 1; //cin >> Test;
    for ( int i = 1 ; i <= Test ; i++ ){

        run_case();
        //
        cout << '\n';
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 600 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct