Submission #375160

# Submission time Handle Problem Language Result Execution time Memory
375160 2021-03-09T03:50:03 Z rinri Sifra (COCI21_sifra) C++14
50 / 50
1 ms 364 KB
/*
#pragma GCC target ("avx2")
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
*/
#include "bits/stdc++.h"
 
#define iosb ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define BIT(x) __builtin_popcount(x)
#define all(x) x.begin() , x.end()
#define F first
#define S second
#define pb push_back
 
using namespace std ;
 
typedef unsigned long long UL ;
typedef long long L ;
typedef string T ;
typedef int I ;
 
const I MaxN =      1e5+1 ;
const I MOD =       1e9+7 ;
const I inf =       2e9+7 ;
const L INF = 2e18+7 ;
 
int32_t main()
{
    //freopen(".in" , "r" , stdin) ;
    //freopen(".out" , "w" , stdout) ;
    string s ;
    cin >> s ;
    set<string> st ;
    for(int i = 0 ; i < s.size() ; ++i)
    {
        if(s[i] >= '0' && s[i] <= '9')
        {
            string t = "" ;
            int j ;
            for(j = i ; j < s.size() ; ++j)
                if(s[j] >= '0' && s[j] <= '9')
                    t+=s[j] ;
                else
                    break ;
            st.insert(t) ;
            i = j-1 ;
        }
    }
    cout << st.size() ;
}

Compilation message

Main.cpp: In function 'int32_t main()':
Main.cpp:34:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |     for(int i = 0 ; i < s.size() ; ++i)
      |                     ~~^~~~~~~~~~
Main.cpp:40:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   40 |             for(j = i ; j < s.size() ; ++j)
      |                         ~~^~~~~~~~~~
# 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 0 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 0 ms 364 KB Output is correct
9 Correct 0 ms 364 KB Output is correct
10 Correct 0 ms 364 KB Output is correct