|
|
Edited by author 04.10.2021 02:11 Add test. My solution O(n^2) on python AC admins is died Edited by author 13.12.2019 06:53 wordd wo dd ans?? wo_dd Edited by author 05.10.2018 16:16 please post it (read chunk) here or give some piece of code, many sanx! java AC 0.171 dont use String.toCharArray btw WA7 (add line 2): 1. for (i=p; i<lena; i++) 2. if (a[i]==' ') out2.print(' '); else 3. out2.print('_'); ab ab abcabcabcd | a b bcd | a_ _b _______bcd | so WA 7 controverses with "The words in both utterances are separated with exactly one space; there are no leading or trailing spaces in each line." Edited by author 07.12.2016 06:15 this input help me pass test #3 lossiblossible lossible answ: ______lossible Thanks, this test help me too))), but now i have TLE on test5 I use hash, but I have TL#5 too, how I can pass this test? help me. Yes! finally I got AC =) may it help somebody: look attentively on this code for (int i = 0;i<strlen(s);i++) { ... } and this int l = strlen(s); for (int i = 0;i<l;i++) { ... } Edited by author 02.11.2009 18:12 Edited by author 02.11.2009 18:14 are you sure this is test 3 ? perhaps i can't really understand the description because it works just fine but it always breaks on test 3... can someone help with these intervals or... i don't know give some tests to try abcx abcxx abcxx abc abcx abc x My programm gives answ "I HAVE FAILED!!!" for test abcx abcxx abcxx abc abcx abc x Is it rigth answer??? sorry.i found my mistake.Now i have wa7 And what is now your answer for a test? And check may be you put a trailling space at the end... Why the answer for the input lossiblossible lossible is ______lossible instead of lossibl______e ? Edited by author 05.03.2016 04:02 Edited by author 05.03.2016 04:03 Lucas Lustosa Madureira, No. Edited by author 20.06.2016 20:59 s = input() sl = input().split() result = '' _delete = lambda ls: ''.join({' ': ' '}.get(lc, '_') for lc in ls) def delete(ls): global s, result try: pos = s.index(ls) except: print('I HAVE FAILED!!!') exit() result += _delete(s[:pos]) s = s[pos:] result += ls s = s[len(ls):] is_first = True for ls in sl: if is_first: is_first = False else: delete(' ') delete(ls) print(result+_delete(s)) It's WA3 too Edited by author 20.06.2016 20:58 Sunnat C 0.015 316 КБ I don't know KMP but I know HASH... and i have accepted... For example solution number 4974296 time is 0.75. This solution does not use either Z-function or KMP, just std::string::find. Admins, is it intended solution complexity for this problem or time limit should be decreased to for example 0.5 s? I have tried to solve this problem, using std::find and string, but failed with TL#5. Can you please explain your idea to me? My e-mail is: marqueewinq@gmail.com I use KMP algorithm but i've got TLE at #9 my code is: [code deleted] what can I improve? How did you solve-it? Edited by author 09.04.2011 20:54 You don't need KMP in this task. I can't even image how this algo helps to solve it. The solution is much more simple. Just find the least position for every word. I got AC even with std::string and the function str.find() Can you give me an example? How to use str.find() in c++? My email adress is catalin_oancea2008@yahoo.com Edited by author 12.04.2011 21:46 I have Wa 9. Can anybody help me ? try this: in: =========================== hhahaphapphappyhappyhh hap happ hh out: =========================== ___hap____happ______hh this test helps me to find a bug. thanks. #include <cstdio> #define forn(i, n) for (int i = 0; i < (int)(n); i++) int main() { int n = (int)1e5; forn(i, n) putchar('a'); puts(""); forn(i, n / 2) putchar('a' + (i == n / 4)); puts(""); return 0; } Submission 3766657 should get TLE. Your test was added. Thank you. Why?! May be cause your solution is wrong? oO I have TLE on this test... I can't find incorrect test:( I use C# and have TLE5. Can anybody give me a hint how to avoid it? Now I am using IndexOf method to find the position of a substring in a string. What does really mean Crash(Access violation)? For example, if you create an array of char: char S[1000], and you try to get access to S[2000], which doesn't exist. KISS! There is no TA even if you use: from.find(to.substr(to_position, length), from_position) What is TA.. I use it and i have WA on 5th test. KISS! There is no TA even if you use: from.find(to.substr(to_position, length), from_position) KISS! There is no TA even if you use: from.find(to.substr(to_position, length), from_position) I use KMP algorithm but I have WA 9 ... any ideea? Edited by author 08.04.2011 03:05 program ministerstvo; var a,n,i,b,j,k,p,l:longint; s,w,q,r:string; begin readln(s); readln(w); n:=length(s); k:=length(w); i:=1; j:=1; l:=1; p:=1; while i<n do begin if s[i]<>w[j] then begin while s[p]<>w[l] do begin if s[p]=' ' then s[p]:=' ' else s[p]:='_'; p:=p+1; i:=i+1; end; end; if s[i]=w[j] then begin i:=i+1; j:=j+1; l:=j; p:=i; end; end; k:=0; for i:=1 to n do if s[i]<>'_' then k:=k+1; if k<length(w) then writeln('I HAVE FAILED!!!') else begin if w[length(w)]=s[n] then write(s[i]) else begin for i:=1 to n-1 do write(s[i]); end; end; end. Is string comparing case-sensitive? f.e. if word WORD for WD W__D is right? Edited by author 01.11.2009 16:44 inp: word wd ans: I HAVE FAILED!!! _____ word -> w__d -> w d !=wd |
|
|