Submission #375118

# Submission time Handle Problem Language Result Execution time Memory
375118 2021-03-09T03:17:23 Z IldarKA Sifra (COCI21_sifra) C++14
50 / 50
1 ms 364 KB
#include <bits/stdc++.h>

using namespace std;
string s;
int cnt;
int main(){
    cin >> s;
    bool ok = 0;
    int san = 0;
    vector < int > v;
    for(int i = 0; i < s.size(); i++){
        if(s[i] >= '0' && s[i] <= '9'){
            san = (san * 10) + int(s[i] - '0');
            if(!ok){
                ok = 1;
            }
            if(i + 1 == (int)s.size()){
                v.push_back(san);
            }
        }
        else{
            if(ok){
                v.push_back(san);
                san = 0;
                ok = 0;
            }
        }
    }
    sort(v.begin(), v.end());
    v.resize(unique(v.begin(), v.end()) - v.begin());
    cout << v.size();
}

Compilation message

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