Submission #367377

# Submission time Handle Problem Language Result Execution time Memory
367377 2021-02-17T03:27:11 Z bad_in_physics Sifra (COCI21_sifra) C++17
30 / 50
1 ms 384 KB
#include<bits/stdc++.h>
#define ll long long int

using namespace std;

void solve () {
	string arr;
	cin>>arr;
	arr += 'a';
	string ans = "";
	set<string> s;
	for (int i=0; i<arr.length(); i++) {
		if (arr[i]=='1' | arr[i]=='2' | arr[i]=='3' | arr[i]=='4' | arr[i]=='5' | arr[i]=='6' | arr[i]=='7' | arr[i]=='8' | arr[i]=='9') {
			ans += arr[i];
		} else {
			if (ans.length()>0) {
				s.insert(ans);
				ans = "";
			}
		}
	} cout<<s.size();
}

int main(void) {
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	solve();
	return 0;
}

Compilation message

Main.cpp: In function 'void solve()':
Main.cpp:12:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   12 |  for (int i=0; i<arr.length(); i++) {
      |                ~^~~~~~~~~~~~~
Main.cpp:13:13: warning: suggest parentheses around comparison in operand of '|' [-Wparentheses]
   13 |   if (arr[i]=='1' | arr[i]=='2' | arr[i]=='3' | arr[i]=='4' | arr[i]=='5' | arr[i]=='6' | arr[i]=='7' | arr[i]=='8' | arr[i]=='9') {
Main.cpp:13:41: warning: suggest parentheses around comparison in operand of '|' [-Wparentheses]
   13 |   if (arr[i]=='1' | arr[i]=='2' | arr[i]=='3' | arr[i]=='4' | arr[i]=='5' | arr[i]=='6' | arr[i]=='7' | arr[i]=='8' | arr[i]=='9') {
Main.cpp:13:55: warning: suggest parentheses around comparison in operand of '|' [-Wparentheses]
   13 |   if (arr[i]=='1' | arr[i]=='2' | arr[i]=='3' | arr[i]=='4' | arr[i]=='5' | arr[i]=='6' | arr[i]=='7' | arr[i]=='8' | arr[i]=='9') {
Main.cpp:13:69: warning: suggest parentheses around comparison in operand of '|' [-Wparentheses]
   13 |   if (arr[i]=='1' | arr[i]=='2' | arr[i]=='3' | arr[i]=='4' | arr[i]=='5' | arr[i]=='6' | arr[i]=='7' | arr[i]=='8' | arr[i]=='9') {
Main.cpp:13:83: warning: suggest parentheses around comparison in operand of '|' [-Wparentheses]
   13 |   if (arr[i]=='1' | arr[i]=='2' | arr[i]=='3' | arr[i]=='4' | arr[i]=='5' | arr[i]=='6' | arr[i]=='7' | arr[i]=='8' | arr[i]=='9') {
Main.cpp:13:97: warning: suggest parentheses around comparison in operand of '|' [-Wparentheses]
   13 |   if (arr[i]=='1' | arr[i]=='2' | arr[i]=='3' | arr[i]=='4' | arr[i]=='5' | arr[i]=='6' | arr[i]=='7' | arr[i]=='8' | arr[i]=='9') {
Main.cpp:13:111: warning: suggest parentheses around comparison in operand of '|' [-Wparentheses]
   13 |   if (arr[i]=='1' | arr[i]=='2' | arr[i]=='3' | arr[i]=='4' | arr[i]=='5' | arr[i]=='6' | arr[i]=='7' | arr[i]=='8' | arr[i]=='9') {
Main.cpp:13:125: warning: suggest parentheses around comparison in operand of '|' [-Wparentheses]
   13 |   if (arr[i]=='1' | arr[i]=='2' | arr[i]=='3' | arr[i]=='4' | arr[i]=='5' | arr[i]=='6' | arr[i]=='7' | arr[i]=='8' | arr[i]=='9') {
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Incorrect 1 ms 364 KB Output isn't correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Incorrect 1 ms 364 KB Output isn't correct
8 Incorrect 1 ms 364 KB Output isn't correct
9 Correct 0 ms 364 KB Output is correct
10 Incorrect 0 ms 364 KB Output isn't correct