Submission #475133

# Submission time Handle Problem Language Result Execution time Memory
475133 2021-09-21T09:26:00 Z Ahmed57 Sifra (COCI21_sifra) C++14
20 / 50
1 ms 204 KB
#include<bits/stdc++.h>
using namespace std;
int mod = 1000000007;
int main(){
    //ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    //please help me in this problem xD
    string s,c;
    cin>>s;int ans = 0;
    map<string,int> mp;
    for(int i =0 ;i<s.size();i++){
        if(!isdigit(s[i])){
            if(!c.empty()){
                string f;bool ss = false;
                for(int j = 0;j<c.size();j++){
                    if(c[j]!='0')ss=true;
                    if(ss)f+=c[j];
                }
                if(mp[f]==0){
                    mp[f] = 1;
                    ans++;
                }
                c = "";
            }
        }else c+=s[i];
    }
    string f;bool ss = false;
    for(int j = 0;j<c.size();j++){
    if(c[j]!='0')ss=true;
    if(ss)f+=c[j];
    }
    if(mp[f]==0){
        mp[f] = 1;
        ans++;
    }
    cout<<ans<<"\n";
	return 0;
}

Compilation message

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