Connection Status:
Competition Arena > Russian
SRM 119 · 2002-11-07 · by axchma
Class Name: Russian
Return Type: int[]
Method Name: suspected
Arg Types: (vector<string>)
Problem Statement

Problem Statement

Some Russian capital letters are written the same way as some English capital letters. Namely, the set of English letters which have a match in Russian is the following: A, B, C, E, H, K, M, O, P, T, X, Y. Moreover, the digits 4 and 3 look very similar to the Russian letters 'Ch' and 'Z' (and, of course, the digit 0 can replace the letter O). Russian immigrants use this fact to order customized license plate numbers for their cars, so that the plate number is a meaningful Russian word. For example, "KAPETA", when read in Russian, means "carriage".

There were some complaints made that there are cars around with obscene words in Russian as their plate numbers. Because of this, the Division of Motor Vehicles needs to check customized plate applications, to see whether or not they might be in Russian.

Your task is, given a String[], check each String to see whether it can be viewed as written in Russian. A String might be written in Russian if all of its characters belong to the set described above. Return the indices of suspected Strings (counting starts from 1) in ascending order.

For your convenience, here are the suspicious characters again: ABCEHKMOPTXY034

Constraints

  • plates has between 0 and 50 elements inclusive
  • each element of plates consists only of capital letters [A-Z] and digits [0-9]
  • each element of plates has between 3 and 8 characters inclusive
Examples
0)
{"MAMA","PAPA"}
Returns: { 1,  2 }
1)
{"ZAMA","TA4KA","KOMAP"}
Returns: { 2,  3 }
2)
{}
Returns: { }
3)
{"CCCP","USSR","AAA","LLL","333","555"}
Returns: { 1,  3,  5 }
4)
{"AAA","BBB","CCC","DDD","EEE","FFF","GGG","HHH","III","JJJ","KKK","LLL","MMM","NNN","OOO","PPP","QQQ","RRR","SSS","TTT","UUU","VVV","WWW","XXX","YYY","ZZZ","000","111","222","333","444","555","666","777","888","999"}
Returns: { 1,  2,  3,  5,  8,  11,  13,  15,  16,  20,  24,  25,  27,  30,  31 }
5)
{"3O43AC0X","03XHOB3P","3A4X03O0","PXYCTOKY","PCCBXEOP","3CHETE3O","PXA34EB3","PH0KBCT4","MECXXXT3","EO0THCTB","A0PMAEK4","C4BYE4O0","ACBTECXB","KMHTBHXT","CPC4MXA0","0YPYHP44","TTKPB4YB","MXEMM3PB","KPK00TEH","KAHKMYOT","EB3BX0TK","AKBMCEAY","HCHTXKAM","PKCC4TYY","BPTYPPKO","ACYPCX4P","THHTX4PO","XEPKMPTX","34MT0KPB","BAPA04YA","XMMHMOBE","OXO0TK3O","MPCBHBBT","KB3M3XA4","YPP0CEOC","HO4MCEMO","PXXOTM4Y","BMXBP404","XTHBOTHY","OEPEPOOK","ABOHBAH4","OYMX4APX","H4APOPOX","T4EYEKO0","P4OKX30K","33YYYOHP","YHHBCKYC","4CTXM0HY","PTXTBTCP","OMAHKACX"}
Returns: { 1,  2,  3,  4,  5,  6,  7,  8,  9,  10,  11,  12,  13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25,  26,  27,  28,  29,  30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,  48,  49,  50 }

Suspicious looking random fluff.

6)
{"KDMCGN0M","LO20FUMB","JTMY0YSX","DI72NTLA","5TQ7TJY1","V3PEHKYI","AN7ZDWJZ","Z0OWSFL4","OCAPYDCN","K2DDVLAY","EAQAUUJF","0W7Q1B7V","7S18J837","LNJLOOOC","3HA2A43J","IK7ICOYO","GGSYT2N8","Q08NTP46","B9V4Y5UP","P29P7STB","V7ZYSXEP","0SEJMFX9","BJ5NOR9E","WAVHJBU5","BJ5EGAZO","Q6INHOI0","5NY8PJ3H","XCSIB1K5","YXJOGRDA","6OAMDMPE","PRU26321","ZQJ4YC5P","17IS0PXI","XTQMEJLS","R45NS4KA","UOPQDX2R","Y4IKDC9E","Q96J9VTA","NB2HQNL2","GC9UQKZF","YWIYCSZ2","B6MHPI82","Q7EFF2MM","X8PJW0S2","89VCBI71","HV6EVGD1","LX5YJ2WK","VCAZONZU","Q464HQ5H","0ITYMVYQ"}
Returns: { }

Perfectly innocent random fluff (with supicious letters in it).

10)
{"ZAA","OHO","4XO","0BB","ZHK","TK0","YTY","P3Z","X33","YBA","OXK","BOK","O4C","CPY","AT3","TZ4","4CT","X4A","4CB","4XT","AE0","PYC","K4M","H33","AHZ","XAC","XM3","MMA","ETE","X4M","OPB","XYK","ACM","P0Y","ZO4","MO4","X3K","3KC","H4O","MB0","ET0","KET","0EB","MOK","4C0","P3K","OAT","MBY","MOE","A4Z"}
Returns: { 2,  3,  4,  6,  7,  9,  10,  11,  12,  13,  14,  15,  17,  18,  19,  20,  21,  22,  23,  24,  26,  27,  28,  29,  30,  31,  32,  33,  34,  36,  37,  38,  39,  40,  41,  42,  43,  44,  45,  46,  47,  48,  49 }

Very suspicious, except for the Z

Submissions are judged against all 15 archived test cases, of which 8 are shown here. Case numbers match the judge’s.

Coding Area

Language: C++17 · define a public class Russian with a public method vector<int> suspected(vector<string> plates) · 15 test cases · 2 s / 256 MB per case

Submitting as anonymous