Submission #104669

# Submission time Handle Problem Language Result Execution time Memory
104669 2019-04-08T16:10:57 Z MatesV13 Marko (COCI15_marko) C++11
50 / 50
16 ms 1484 KB
#include <bits/stdc++.h>
using namespace std;
int n;
string w[1005], s;
bool ok[1005];
int tonum(char x){
	if (x=='a') return 2;
	if (x=='b') return 2;
	if (x=='c') return 2;
	if (x=='d') return 3;
	if (x=='e') return 3;
	if (x=='f') return 3;
	if (x=='g') return 4;
	if (x=='h') return 4;
	if (x=='i') return 4;
	if (x=='j') return 5;
	if (x=='k') return 5;
	if (x=='l') return 5;
	if (x=='m') return 6;
	if (x=='n') return 6;
	if (x=='o') return 6;
	if (x=='p') return 7;
	if (x=='q') return 7;
	if (x=='r') return 7;
	if (x=='s') return 7;
	if (x=='t') return 8;
	if (x=='u') return 8;
	if (x=='v') return 8;
	if (x=='w') return 9;
	if (x=='x') return 9;
	if (x=='y') return 9;
	if (x=='z') return 9;
}
int main (){
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for (int i=0;i<n;i++){
	cin >> w[i];
	ok[i]++;
}
cin >> s;
for (int i=0;i<s.size();i++){
	for (int j=0;j<n;j++){
		if (tonum(w[j][i]) != (int)s[i] - (int)'0') ok[j]=0;
	}
}
int ans=0;
for (int i=0;i<n;i++) ans+=ok[i];
cout << ans;
return 0;
}

Compilation message

marko.cpp: In function 'int main()':
marko.cpp:40:7: warning: use of an operand of type 'bool' in 'operator++' is deprecated [-Wdeprecated]
  ok[i]++;
       ^~
marko.cpp:43:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 for (int i=0;i<s.size();i++){
              ~^~~~~~~~~
marko.cpp: In function 'int tonum(char)':
marko.cpp:33:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 512 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 12 ms 1408 KB Output is correct
5 Correct 4 ms 512 KB Output is correct
6 Correct 5 ms 640 KB Output is correct
7 Correct 5 ms 1024 KB Output is correct
8 Correct 16 ms 1484 KB Output is correct
9 Correct 4 ms 512 KB Output is correct
10 Correct 12 ms 1152 KB Output is correct