Show all threads Hide all threads Show all messages Hide all messages |
Easy ~ | [RISE] Levon Oganesyan [RAU] | 1685. Orthography | 13 Mar 2023 21:23 | 6 |
Easy ~ [RISE] Levon Oganesyan [RAU] 3 Aug 2014 05:07 My solution is 20 lines. Easy problem. 14 lines solution with using recursive function. Re: Easy ~ [RISE] Levon Oganesyan [RAU] 31 Aug 2014 21:03 I have recursive function too. Whatever, Good Job! 7 lines with recursive func in python 3. Or 14 with normal look a code. |
please check my code WA 3 | Raman Gupta | 1685. Orthography | 3 Feb 2019 13:55 | 4 |
#pragma comment(linker, "/STACK:16777216") #include <stdio.h> #include <string.h> #define size 20010 char str[size]; char arr[size]; int i=0; void recurse(int low,int high){ int mid; if(low>high) return; mid = (low+high)/2; arr[mid] = str[i++]; recurse(low,mid-1); recurse(mid+1,high); } int main(){ scanf(" %[^\n]s",str); recurse(0,strlen(str)-1); printf("%s\n",arr); return 0; } /*I simply used recursion and its working for all the test I know presently.Please tell me what is the problem in the code*/ the same def solve(str): l = len(str) if l<=2: return str mid = (1+l)//2 return solve(str[1:mid]) + str[0] + solve(str[mid:]) print solve(sys.stdin.readline().strip()) it's working for all the test I know, but get WA3 here Xel,отличное решение! Только вместо функции strip() нужна функция strip('\n'), иначе удаляются все концевые пробелы и этим самым нарушаются входные данные. Edited by author 03.02.2019 13:56 |
My solution in Python 3 took 0.078 seconds and 516 KB with recursion. Can you do it faster? | Dhruv Somani | 1685. Orthography | 18 Aug 2018 18:46 | 2 |
My solution in Python 3 took 0.078 seconds and 516 KB with recursion. Can you do it faster? you can try to to it with stack instead of recursion |
Какой формат вывода? | Felix_Mate | 1685. Orthography | 10 May 2016 23:17 | 2 |
Не понимаю фразу:"Строка должна оканчиваться символом перевода строки." Что это интересно за символ в паскале? Мой код: const Nmax=21000; var a,s:array[1..Nmax] of char; N,i,L,R:longint; ch:char;
procedure Solve(L,R,i:longint); var m:longint; begin if(R-L>1) then begin m:=(L+R) div 2; a[m]:=s[i]; Solve(L,m-1,i+1); Solve(m+1,R,m-L+i+1); end else begin a[l]:=s[i]; if(R>L) then a[R]:=s[i+1]; end; end;
begin N:=0; while not eof do begin read(ch); inc(N); s[n]:=ch; end;
L:=1; R:=N; Solve(L,R,1); for i:=1 to N-1 do write(a[i]); writeln(a[n]); end. Возможно, нужно вывести все символы в строке с помощью команды write, а затем просто добавить строку writeln. |
Test 15 is a space or multispace!! Be careful!! | Nguyen Trung Hieu | 1685. Orthography | 20 Jan 2014 10:26 | 1 |
Test 15 is a space or multispace!! Be careful!! |
How this : "orthography, we get gtorhoprahy",I can't understand | Pegasus | 1685. Orthography | 15 Nov 2012 19:53 | 1 |
|
Correct answer for test | _-Re@l-_ | 1685. Orthography | 5 Jul 2012 15:09 | 2 |
Test : abcdefgh Answer : dbacfeg Is this answer correct? no, correct answer is "cbdafegh" |
WA#8 | Vitaliy Karelin | 1685. Orthography | 22 Jun 2012 19:20 | 3 |
WA#8 Vitaliy Karelin 28 Feb 2009 17:21 Does anybody has any idea? Me too and I dont think I'm wrong Send your email. I help you. |
Correct answer for test | _-Re@l-_ | 1685. Orthography | 1 May 2012 15:53 | 3 |
Test : abcdefgh Answer : dbacfeg Is this answer correct? нет! как минимум, в первом слове букв больше :D Edited by author 01.05.2012 15:15 Edited by author 01.05.2012 15:15 Oh, of course :D I want to say, is answer dbacfegh is correct. But now I already know, that my old algorithm hadn't been correct and here is just recursion. |
What is answer to "один глаз, один рог, но не носорог"? | silveracm3 | 1685. Orthography | 7 Oct 2011 19:29 | 3 |
What is "г рковоаззи- аул лаывгвдяыеат"? I have no desire to suffer with Russian letters in the console. Answer: "корова из-за угла выглядывает". Translated by Google: "cow from behind a corner peeps". Sorry for my bad English :) #include <iostream> #include <string> #include <windows.h> using namespace std; string s; string f( long b, long e ){ //lalalalalala } int main(){ #ifndef ONLINE_JUDGE freopen("input.txt", "rt", stdin); freopen("output.txt", "wt", stdout); #endif SetConsoleCP(1251); SetConsoleOutputCP(1251); s = "г рковоаззи- аул лаывгвдяыеат"; cout << f( 0, s.size()-1 ) << endl; return 0; } |
why? | aaa | 1685. Orthography | 23 Aug 2011 15:06 | 6 |
why? aaa 28 Feb 2009 17:40 where i am wrong please write me aramvmv@mail.ru #include <iostream> using namespace std; __int64 i,n,k, o[20110]={0},l=0, s,t,j,m,r; char a[20110], c[20110]; int main() { cin.ignore(); cin.getline(a,20110); n=strlen(a); k=n; t=1; while(k!=0) {c[(k+1)/2]=a[t]; o[(k+1)/2]=1; k=(k+1)/2; t++; } for(j=0;j<n/4;j++) { for(i=1;i<=n;i++) if(o[i]==0) {l=1; m=s=i; while(o[i+l]==0) {l++; m+=i+l;} if(l==0) break; if(l==1) {c[s]=a[t]; o[s]=1;} else {k=m/l; while(k>=s) {c[k]=a[t]; o[(k+1)/2]=1; l/=2;m=0; for(r=s;r<s+l;r++)m+=r; k=m/l; t++; }}}} for(i=1;i<=n;i++) cout<<c[i]; return 0;} here is my new solution but again crash #include <iostream> using namespace std; __int64 i,n,k, o[20110]={0},l=0, s,t,j,m,r; char a[20110], c[20110]; int main() { cin.ignore(); cin.getline(a,20110); n=strlen(a); k=n; t=1; while(k!=0) {c[(k+1)/2]=a[t]; o[(k+1)/2]=1; k=(k+1)/2; t++; } for(j=0;j<n/4;j++) { for(i=1;i<=n;i++) if(o[i]==0) {l=1; s=i; while(o[i+l]==0) {l++; } if(l==0) break; if(l==1) {c[s]=a[t]; o[s]=1;} else {k=s+l; while(k>=s) {c[(k+s)/2]=a[t]; o[(k+s)/2]=1; k=(k+s)/2; t++; }}l=0; }} for(i=1;i<=n;i++) cout<<c[i]; return 0;} Re: why? Oleg Strekalovsky [Vologda SPU] 18 May 2009 18:55 I solved this problem by Java with recursive function. I think it's more easy :) recursive function is the best method for solving this problem, i thenk =D |
WA1, please give test | Vasily Slesarev | 1685. Orthography | 5 Jul 2011 01:11 | 2 |
My program passes tests "kyaVs alisse uop." and "gtorhoprahy" but get WA1. Please help. Now AC. The problew was that I used getchar() instead of gets(). |
To all who got wa17 | sklyack | 1685. Orthography | 5 Feb 2011 00:49 | 1 |
With array of 20001 chars (with '\0') I got wa17, but of 20002 I got AC. So the input string can contain 20001 chars, can't it? And in the statement has been said "The text is no longer than 20000"... |
No subject | hhh | 1685. Orthography | 23 Sep 2010 20:57 | 4 |
please smb send me the solution or the idea my mail is vgvavlad@gmail.com [code deleted] Edited by moderator 19.11.2019 23:23 Thank you very much for this algoritm! This is exellent program! |
Need data.. plz (wa1) | Ivan | 1685. Orthography | 12 Mar 2010 22:00 | 1 |
Mods, send input data for test1 please. Trying to solve the problem second day already. Thx vanvector@mail.ru |
Be careful on different OS | aSSault | 1685. Orthography | 6 Oct 2009 16:09 | 1 |
If using Java BufferedReader pay attention on number of symbols read. While testing in eclipse I used N-1. But on Timus server N-2 was accepted Edited by author 06.10.2009 16:13 |
what to do with punctuation marks? | Anupam Ghosh,Bengal Engg and Sc Uni,MtechIT,2006-09,India | 1685. Orthography | 10 Aug 2009 12:01 | 1 |
orthography gives gtorhoprahy but “one eye, one horn, but not a rhino” gives “reo ac wpeosr tu fdbmo heinoa cnrer” where are the comma's gone??? somebody please help me understand the problem Edited by author 10.08.2009 12:02 Edited by author 10.08.2009 12:02 Edited by author 10.08.2009 12:02 |
Crash #8 | Ivan Zdomskyy_IvanoFrankivsk_SU | 1685. Orthography | 4 Mar 2009 20:55 | 3 |
Crash #8 Ivan Zdomskyy_IvanoFrankivsk_SU 3 Mar 2009 14:08 Why Crash (stack overflow)#8 ???? Help,please =) Use directive somelike #pragma comment(linker, "/STACK:16777216") This is described in the FAQ to this site. Re: Crash #8 Ivan Zdomskyy_IvanoFrankivsk_SU 4 Mar 2009 20:55 |
Input of the Test #15 is just one character! | gio_gio | 1685. Orthography | 1 Mar 2009 17:17 | 1 |
|