Submission #366946

# Submission time Handle Problem Language Result Execution time Memory
366946 2021-02-15T19:04:22 Z uacoder123 Sifra (COCI21_sifra) C++14
50 / 50
1 ms 364 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define F first
#define S second
#define FOR(i,a,b) for (auto i = (a); i <= (b); ++i)
#define NFOR(i,a,b) for(auto i = (a); i >= (b); --i)
#define all(x) (x).begin(), (x).end()
#define sz(x) lli(x.size())
#define mp(i,a) make_pair(i,a)
#define pb(a) push_back(a)
#define bit(x,b) (x&(1LL<<b))
typedef long long int lli;
typedef pair <lli,lli> ii;
typedef pair <ii,lli> iii;
typedef vector <lli> vi;
typedef tree<lli,null_type,less<lli>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  lli test=1;
  string s;
  cin>>s;
  int a=0;
  set<int> se;
  for(int i=0;i<s.size();++i)
  {
    if(s[i]>='0'&&s[i]<='9')
    {
      a*=10;
      a+=(s[i]-'0');
    }
    else
    {
      if(a!=0)
      {
        se.insert(a);
        a=0;
      }
    }
  }

      if(a!=0)
        se.insert(a);
      cout<<se.size()<<endl;
  return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:29:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |   for(int i=0;i<s.size();++i)
      |               ~^~~~~~~~~
Main.cpp:24:7: warning: unused variable 'test' [-Wunused-variable]
   24 |   lli test=1;
      |       ^~~~
# 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 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 1 ms 364 KB Output is correct