Show all threads Hide all threads Show all messages Hide all messages |
No subject | emhope | 1177. Like Comparisons | 27 Feb 2022 01:55 | 1 |
Edited by author 27.02.2022 15:58 |
If you get WA #3 | Deepesson | 1177. Like Comparisons | 20 Jun 2021 15:50 | 2 |
Input: 3 '╣' like '[╣-I]' '╣' like '╣' '╣' like '_' Output: YES YES YES My AC solution gives NO to the first one; there should be no tests where the start character in a range is greater than the end character. |
WA #7 | 👨🏻💻 Spatarel Dan Constantin | 1177. Like Comparisons | 3 Jul 2019 23:00 | 1 |
WA #7 👨🏻💻 Spatarel Dan Constantin 3 Jul 2019 23:00 input: 1 'a-z' like 'a-z' output: YES Edited by author 03.07.2019 23:01 Edited by author 03.07.2019 23:01 |
6. case | Strahinja Popovic | 1177. Like Comparisons | 3 Jul 2019 22:50 | 2 |
6. case Strahinja Popovic 12 Apr 2010 18:46 Hi, I have tried like million times different combinations, and it always gives wrong answer, always on 6. case. Does anyone have 6. case? Does any anyone have any idea what kind of strings/patterns are in 6. case? Thanks in advance Re: 6. case 👨🏻💻 Spatarel Dan Constantin 3 Jul 2019 22:50 In test 6 there are several consecutive '%' chars in the pattern. I got TLE, then replaced "%%" with "%" and passed. I'm guessing you can get WA on test 6 if you're not matching the empty string with "%". |
Should I care of incomplete square braces? | sanok | 1177. Like Comparisons | 4 Apr 2018 08:04 | 2 |
Should I care of patterns with incomplete square braces? For example 'a[b' (and probably treat '[' as a regular character for matching. Or there is no such tests? No such tests. (I like to put asserts in unclear cases like these and see if they fire) No [] or [^] either |
Question about ' like ' parsing and apostrophe encoding | Mickkie | 1177. Like Comparisons | 8 Oct 2017 07:07 | 2 |
How to deal with case like this ' ' like ' like ' like ' like ' 'like ' it can be splitted as ( ) & ( like ' like ' like ' 'like ) or ( ' like ) & ( like ' like ' 'like ) or ( ' like ' like ) & ( like ' 'like ) or ( ' like ' like ' like ) & ( 'like ) Can you clarify this statement Inner entrance of apostrophe symbol (ASCII 39) into string or template is encoded by double apostrophe symbol And if it's true the case ''hi'' like ''hi'' will be changed to '"hi'' like '"hi' Am I right? Then how is this case possible? '''''' like '_''' The apostrophe symbol (ASCII 39) if appear in string or template will be double (now it becomes 2 successive apostrophe symbols). The English problem statement is wrong to me since it made us think that ASCII 39 is replaced by ASCII 34 or something. But in fact, ASCII 39 is replaced by two ASCII 39. At least, I got AC after using my above interpretation. |
Why '''''' like '_''' = True? | Vokin Andrei (vokin_andrei@mail.ru) | 1177. Like Comparisons | 29 Mar 2017 23:38 | 4 |
Reason Han Wentao 19 Feb 2002 08:36 In fact, the string are two apostrophe symbols, and the template are an underline and an apostrophe symbol. An underline can match any single character, and the other apostrophe can match the second apostrophe. So, the answer is 'YES'. Re: Reason Ionkin M [Samara SAU #617] 29 Mar 2017 23:38 |
Any hint about test #3 ? | sanok | 1177. Like Comparisons | 30 Nov 2016 12:59 | 2 |
Hi, My program pass all local tests but crashes after submit on test #3. Most probably I miss some boundary or weird pattern case. I use C++ and I took into account the fact that char's over 127 are converted to negative integers. Do you have any hint? UPD: My local test file: 31 '' like '%' '' like '' 'a' like 'a%' '·' like '·' 'f' like '[z-a]' 'a' like '[a-]' '·' like '[·a]' 'abcde' like 'a' 'abcde' like 'a%' 'abcde' like '%a' 'abcde' like 'b' 'abcde' like 'b%' 'abcde' like '%b' '25%' like '_5[%]' '_52' like '[_]5%' 'ab' like 'a[a-cdf]' 'ad' like 'a[a-cdf]' 'ab' like 'a[-acdf]' 'a-' like 'a[-acdf]' '[]' like '[[]]' '''''' like '_''' 'U' like '[^a-zA-Z0-9]' 'like' like 'like' ''' '' ' like ''' ''%' '[' like '[[]' '%' like '[%]' '_' like '[_]' ']' like ']' '^' like '^' 'like' like 'like' ''' '' ' like ''' ''%' |
Wa 2 | Victor Barinov (TNU) | 1177. Like Comparisons | 14 Oct 2015 20:19 | 4 |
Wa 2 Victor Barinov (TNU) 29 Jun 2008 00:14 if you get WA on test #2, then try to use unsigned char* instead char* I have done it with char s[], you don't have to use unsigned char s[] !!! I used scanf ... Edited by author 03.04.2010 00:08 I had WA2 with some test like this 'a' like '[a-]' YES Because there may be spaces in the input, "scanf("%s")" may not be accepted... |
Some tests | yeziqing10 | 1177. Like Comparisons | 14 Oct 2015 20:15 | 1 |
2 'like' like 'like' ''' '' ' like ''' ''%' YES YES Tests may also have spaces, so it is a confusing question to determine how to get the string and the pattern. I got 14 WA on this question, and finally AC. QWQ Edited by author 14.10.2015 20:17 |
Some questions | Mephistos | 1177. Like Comparisons | 7 Aug 2015 20:05 | 5 |
What are answers for following comparisions? '[]' like '[]' '' like '[]' 'a' like '[--z]' 'b' like '[c-a]' '-' like '[a-f-h]' 'g' like '[a-f-h]' Thank you for your opinion... Just read the Excel, or Access rules about operator "Like", some problems will disappear. Add some success to this and you will be accepted! |
An attempt to make the problem statement clear finally (+) | Michael Rybak (accepted@ukr.net) | 1177. Like Comparisons | 7 Aug 2015 20:03 | 5 |
As this problem's statement is really hard to interpret unambiguously, I've decided to make this attempt to explain my view on it, which seems to be the one that authors meant. Here’s the list of notes that make the problem more clear: in template: 1. Brackets ‘[]’ have the highest priority. Find the leftmost ‘[‘, then find the first ‘]’ after it; you can assume that these two brackets strictly correspond to each other, i.e. can’t be considered to correspond to any other brackets. Then find the first opening bracket after current closing one and so on. 2. Such templates, as [] and [^] are incorrect and don’t happen in test cases. 3. Given an opening bracket [ and a corresponding closing bracket ], let’s consider the string S between them. As Vladimir Yakovlev already stated, special characters '[', '%' and '_' mean themselves when included in brackets. Now, let’s describe a boolean function F(c,s), that determines whether template s matches character c. "Del(s,k)" will denote a function, that returns the tail of s starting from position k+1 inclusively. We shall also need a boolean function G: F: If s[1]='^', Then F(c,s):=Not G(c,Del(s,1)), Else F(c,s):=G(c,s) G: If s[2]='–' and length(s)>=3 Then G(c,s):=G(c,Del(s,3)) Or (s[1]<=c<=s[3]) Else G(c,s)=G(c,Del(s,1)) Or (s[1]=c) To my mind, these rules do make the problem statement clear and have nothing to deal with posting Source code, so I hope moderators won’t delete this message. I also want to say thank you to the person posting under nick "I have answers to all your questions :)" for helping people on this problem. In fact, your posts helped me to understand it. Thank you very much for your help. I can't imagine how much time it would take me to understand all this stuff. I think that the problem statement should be fixed. Or, should have the link to your post :) Thank you for formalized statement =) very useful! |
1177- Good problem | svr | 1177. Like Comparisons | 7 Aug 2015 20:01 | 3 |
The problem unexpectedly dosn't contain very tricky tests. Additionally to forum's examples I add the next: 1. Empty string corresponds with '%%%%%%%%' and so on and with empty pattern also; 2. 'a'~'%a' 3. String may contain many "like" substrings . For defining right position dublicable inner '-characters play key role; 4. Dp-method is veru useful, when we are going from ends of strings to their beginnings. Edited by author 11.07.2007 17:24 Dp-method is veru useful, when we are going from ends of strings to their beginnings. My idea is to split the template to multiple templates with no '%', and then search using some modifications of Knuth-Morris-Pratt (except for the first/last template, if there is no '%' at the beginning/end). I just don't know how fast will it be, because I have not coded it yet... DP-method is a good idea =) But I have solution without DP which works for one query as O(max(len1,len2)^2), where len1,len2 - length of string/pattern. Greedy approach only :) And in practise this method works more faster then O(max(len1,len2)^2). Look at rating of best solutions (0.001 sec VS 0.921 sec with DP). If you want I could tell you about my method. Edited by author 07.08.2015 20:01 |
Good tests | Programmer | 1177. Like Comparisons | 7 Aug 2015 19:53 | 2 |
'ab' like '[a]b' 'ab' like '%b' 'ab' like '%%b' 'ab' like '%%%b' 'ab' like '%%%b%' 'ab' like '%%%b%%' 'b' like '%%' Edited by author 01.09.2010 00:37 :) all answers should be YES |
''' like ''' like ''' like ''' | glueckware | 1177. Like Comparisons | 7 Aug 2015 19:52 | 2 |
What is the right answer for the given string? Correct answer for such string is YES |
VERY Important HIINT for C++ solvers. | 198808xc | 1177. Like Comparisons | 8 Oct 2013 21:28 | 2 |
When reading the input, like this: char *Input; cin.getline(...); the chars with ASCII code larger than 127 will become negative integers, for example, if the ASCII code is SUPPOSED to be 160, it will turn out to be 160-128. Fix this trick, and you will get AC. One more, this article will help you VERY MUCH if you don't really understand the problem statements. http://acm.timus.ru/forum/thread.aspx?space=1&num=1177&id=10577&upd=632900666745579610 (It can be found just on the BOARD.) GOOD LUCK~ please give me source kostan3@spaces.ru |
Contradictions: | OlegZubkov | 1177. Like Comparisons | 19 May 2013 14:54 | 1 |
Contradictions: ''' like ' like ''' 'a' like '[a^a]' '#' like '!--0' 'd' like 'a-c-e' and so forth ... In the condition you need to specify that these tests are not available. |
How speed up regular expression engine? I have TL #6 and use Regex.IsMatch method | Olympic Bear | 1177. Like Comparisons | 11 Aug 2012 13:59 | 3 |
answer from Anatoly: Reduce pattern parts of "%%%%%%" to "%". It extremely raises performance of regex engine. It's really helps. From TLE #6 to AC |
AC approach | Anatoly | 1177. Like Comparisons | 25 Jul 2012 16:58 | 4 |
I don't know how to solve it, but I got AC because C#'s regular expression engine knows ;) How speed up C#'s regular expression engine? I have TL #6 and use Regex.IsMatch method Reduce pattern parts of "%%%%%%" to "%". It extremely raises performance of regex engine. |
Any idea why I could get WA 4 ? | Mircea Dima | 1177. Like Comparisons | 4 Jul 2012 20:50 | 4 |
Any idea why I could get WA 4 ? All the tests I gave were ok. Edited by author 16.04.2010 23:25 try this '-' like '[a-b]' maybe it should be no. I got ac just modified it. |