Submission #373264

# Submission time Handle Problem Language Result Execution time Memory
373264 2021-03-04T00:46:54 Z rk42745417 Sifra (COCI21_sifra) C++17
50 / 50
1 ms 384 KB
#include <bits/stdc++.h>
using namespace std;

#define EMT ios::sync_with_stdio(0); cin.tie(0);
using ll = int64_t;
using ull = uint64_t;
using uint = uint32_t;
using ld = long double;
const int MOD = 1e9 + 7;
const int INF = 0x3f3f3f3f;
const ll LINF = 2e18;
const double EPS = 1e-9;

string proc(string s) {
	reverse(s.begin(), s.end());
	while(s.size() > 1 && s.back() == '0')
		s.pop_back();
	reverse(s.begin(), s.end());
	return s;
}

signed main() { EMT
	string s;
	cin >> s;
	set<string> has;
	for(int i = 0, it = 0; i <= s.size(); i++) {
		if(i < s.size() && '0' <= s[i] && s[i] <= '9') {
			
		}
		else {
			if(it < i)
				has.insert(proc(s.substr(it, i - it)));
			it = i + 1;
		}
	}
	cout << has.size() << '\n';
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:26:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |  for(int i = 0, it = 0; i <= s.size(); i++) {
      |                         ~~^~~~~~~~~~~
Main.cpp:27:8: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |   if(i < s.size() && '0' <= s[i] && s[i] <= '9') {
      |      ~~^~~~~~~~~~
# 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 384 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