| Show all threads Hide all threads Show all messages Hide all messages |
| WA 5 | Evgeny | 1723. Sandro's Book | 5 Mar 2012 02:12 | 3 |
WA 5 Evgeny 23 Sep 2011 00:38 I've got WA #5. Help me, please! #include <string.h> #include <iostream> int main(int argc, char* argv[]) { char s[51]; int a[26]; for(int i=0;i<26;i++) a[i] = 0; std::cin>>s; for(int i=0;i<strlen(s);i++) (a[(int)(s[i]) - 91])++; int max = 0; bool g = false; for(int i=0; i<26; i++) if (max<a[i]) { max = a[i]; } for(int i=0;i<strlen(s);i++) if(a[(int)(s[i]) - 91] == max) { g=true; std::cout<< s[i]; a[(int)(s[i]) - 91] = -1; } else if (g) { break; } std::cout<<"\n"; return 0; } Edited by author 23.09.2011 00:42 Edited by author 23.09.2011 00:43 I read ASCII table and got AC! #include <string.h> #include <iostream> int main(int argc, char* argv[]) { char s[51]; int a[26],k=0; for(int i=0;i<26;i++) a[i] = 0; std::cin>>s; for(int i=0;i<strlen(s);i++) (a[(int)(s[i]) - 97])++; int max = 0; for(int i=0; i<26; i++) if (max<a[i]) { max = a[i]; k=i; } k+=97; std::cout<<(char)(k) <<std::endl; return 0; } Hello, I did in the similar way, then I got a matrix, I tied to find the longest string from the matrix.But at this point I saw your post, and just tried printing the maximum repeated character like you have done.But how does that work, even it returns wrong answer for the first test.Can't understand. Please give me some suggestions.
|
| one test | orbby | 1706. Cipher Message 2 | 4 Mar 2012 21:22 | 1 |
6 abcabcabcf 15 15 15 15 18 19 18 18 19 18 |
| Wrong Answer Test#2 | Topravy | 1706. Cipher Message 2 | 4 Mar 2012 20:07 | 1 |
Hi, Please let me know the input for Test#2. I have verified my program with different test cases and is working fine. It would be interesting to see which test case is failing. |
| WA1 | ZZmiy | 1002. Phone Numbers | 4 Mar 2012 09:15 | 7 |
WA1 ZZmiy 13 Oct 2011 21:13 Could anyone post 1st test? My solution passes all tests I found here or come up with myself, but still get WA1. Nevermind, error was in input code :) :( Re: WA1 Gleb Mazovetskiy 19 Dec 2011 10:08 What kind of error? I'm getting WA1 as well; would appreciate if someone could post test 1, thanks Re: WA1 alafeizai 19 Dec 2011 13:26 Try 2111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 4 bj bjj jj jjjj My ouput for the above(posted by Morbidel) is bjj jjjj jjjj jjjj jjjj jjjj jjjj jjjj jjjj jjjj jjjj jjjj jjjj jjjj jjjj jjjj jjjj jjjj jjjj jjjj jjjj jjjj jjjj Is this right? My code passes the tests provided in the problem and also the tests I had made up. Can any one post a criticl test case with expected output? Edited by author 18.01.2012 13:54 I also wa at 1- -.....but dont know why.... |
| help please, I used KMP but I have TLE_5 | Giorgi Saghinadze (Tbilisi SU) | 1423. String Tale | 4 Mar 2012 04:14 | 3 |
#include <iostream> #include <string> using namespace std; long p[260000],x,i,j,k,d,l; char t[260000],s[510000]; void prefix() {
p[0]=0;k=0; for (i=1;i<x;i++) { while ((k>0)&&(t[k]!=t[i])) k=p[k];
if (t[k]==t[i]) k++; p[i]=k;
}
} void solve() { k=0;d=0; for (i=0;i<2*x;i++) { while ((k>0)&&(t[k]!=s[i])) k=p[k]; if (s[i]==t[k]) k++; if (k>=x) {d=1;break;} } l=2*x-i-1; if (l==x) l=0; if (d==0) cout<<-1<<endl; else cout<<l<<endl; } int main() {long l; freopen("input.txt","r",stdin); freopen("output.txt","w",stdout); cin>>x; cin.get(); for (i=1;i<=x;i++) p[i]=0; gets(s); l=strlen(s); gets(t);
strncat(s,s,l); l=strlen(s); prefix();
solve(); fclose(stdin); fclose(stdout); return 0; } what is wrong here? my mistake was: k=p[k] should be k=p[k-1] Giorgi,you a good man))Thank you!My mistake also there)) |
| what is 6 test? | dan20 | 1880. Psych Up's Eigenvalues | 4 Mar 2012 03:21 | 3 |
Tell me what is 6 test pelase you should declare your array more than 4000 int a[4001];// a[] is your array if you have it's all because of range of your array. good luck Edited by author 03.03.2012 22:04 I have a problem! My code give CRASH!#5 What does it mean? |
| WA#2 | Al.Cash | 1384. Goat in the Garden 4 | 4 Mar 2012 02:16 | 2 |
WA#2 Al.Cash 17 Jul 2009 22:44 I've found out that there's a triangle in this test. My program is likely to find the center of inscribed circle correctly, so I don't understand where is the mistake. Can somebody give me more information to pass this test? та же проблема с wrong answer #2 |
| SOLUTION for this problem (Pascal) | daminus | 1607. Taxi | 4 Mar 2012 01:43 | 3 |
[Code deleted by moderator] Edited by moderator 04.03.2012 00:14 If you will not stop posting your source code to the webboard, you will be banned. -- Timus Online Judge admins |
| AC 0.078s!!!!!!!!!!!!!!!!!!!!! | Hrayr | 1726. Visits | 4 Mar 2012 01:06 | 2 |
Edited by author 03.07.2011 19:23 Congratulations!!!!!!!!!!!! |
| what does fairly mean | Nily | 1864. Get-Together at Den's | 4 Mar 2012 00:28 | 8 |
how about this one sample 6 4 3 3 1 1 0 Edited by author 15.10.2011 16:43 Mine gives 47 26 26 0 0 0... I've WA#9 it's my 40 30 30 0 0 0 Edited by author 15.10.2011 17:27 Edited by author 15.10.2011 17:27 AC program 47 26 26 0 0 0 how about this one sample 6 4 3 3 1 1 0 My code give : 33 25 25 8 8 0 |
| O(n^3) algo. | hoan | 1004. Sightseeing Trip | 3 Mar 2012 18:44 | 5 |
this is a O(n^3) algo for this problem: - for each node such v, first you use dijekstra which have a "v" as a root, then you clacute the: k= E.wei + dis[E.e1]+ dis[E.e2]. where E is a edge that not exist in a tree of dijekstra algo, and E is a (e1, e2). and at the end you must print the minimum of all the k. sorry for my poor english. Edited by author 12.11.2010 11:12 Edited by author 12.11.2010 11:13 Well, I solved this problem in O(n^4) fixing a deleted edge and then running dijkstra from one it's vertex to the other, but I want to get better. :-) However I failed to understand your post at all. Could you explain it somehow? Edited by author 13.01.2012 05:11 I read all the posts, collected input test cases posted by people, and passed all of them successfully, but, unfortunately, still i am getting WA#test case 1. Tried everything. But found no clue why my solution is getting WA. Please help me out. Very good idea, thanks for sharing! |
| 1001-crash(test 6) | Arzlom | 1001. Reverse Root | 3 Mar 2012 12:21 | 2 |
#include <iostream> #include<stdio.h> #include<stdlib.h> #include<math.h> #include<iomanip> using namespace std; void main(){ std::cout<<fixed; cout.precision(4); long double K[500];long double L[500]; int flag=0; while (std::cin>>K[flag]) {flag++; };
for(int k=flag-1;k>=0;k--){L[k]=sqrt((double)K[k]); std::cout <<L[k]<<"\n";}; printf(" "); //system("pause"); } and I have this problem.. what this ?!! |
| wrong task | Kholmogorova | 1636. Penalty Time | 2 Mar 2012 17:24 | 1 |
please, change the task! firstly, the first number is time of ZZZ.secondly, if the commands have the same time, the right aswer is 'no chance'. |
| WA #2 I did it correct, Why Wrong Answer??? | Sherzodbek | 1200. Horns and Hoofs | 2 Mar 2012 11:45 | 1 |
input: 2 2 10 Output: 2.00 1 1 Algo: cin>>a>>b; cin>>k; for(i=0; i<=k-1; i++){ for(j=0;j<=k-i; j++){ l=i*i+j*j; g=i*a+j*b; x=g-l; if(x>=r){n++; r=x; s[n]=r; si[n]=i; sj[n]=j;}}} for(int y=1; y<=n; y++){ if(s[n]==s[y]){ cout<<fixed<<setprecision(2)<<s[y]; cout<<endl<<si[y]<<" "<<sj[y]<<endl; } } Is it right? |
| module 10^9 + 9 | TrickY | 1586. Threeprime Numbers | 2 Mar 2012 02:43 | 4 |
I did not quite understand this part. "calculated modulo 10^9 + 9" What does that mean, and what is it used for...? I know what modulo is, but I don't know what am I supposed to do with it... :) Edited by author 06.05.2008 01:54 Edited by author 06.05.2008 01:54 Edited by author 06.05.2008 01:54 There are too many solutions for larger input data, so instead of outputting "solution", you should output "solution mod 1000000009" - if you do not do that during the calculations, the number of solutions will exceed the maximum long size (approximately 2*10^9), therefore crashing your program.22 Req Ganesh R 2 Feb 2012 21:43 I cant understand the o/p. What is the procedure actually.. How can we get 204 on the i/p 4. Can u pls explain There is last limit of programming language! It will be incorrect when you not use 1000000009!!!! (only 1000000009) |
| What is test number 5? | Bahador Biglari | 1005. Stone Pile | 2 Mar 2012 01:00 | 2 |
Can someone explain test number 5? 6 1 4 5 6 7 9 answer: 0 Edited by author 02.03.2012 04:15 |
| Time limit | HSTU_hacker | 1079. Maximum | 1 Mar 2012 21:09 | 2 |
pleas help anybodoy to minimize time in java don't use recusive functions. |
| pair.h | Raven | | 1 Mar 2012 19:27 | 1 |
I tried to use <pair.h> in my programm, but there is a compilation error. How can i use it? I don't wan't to use map. |
| Timus Developers! Can you add internal message system into timus? | Joseph Puh the Battle Bear | | 1 Mar 2012 17:55 | 1 |
It'll be cool to have internal message system (so users can contact directly to each other, without forum)... Comrades! Vote for this, if you agree!!! |
| the problem is too easy. | Alex Tolstov (Vologda STU) | 1730. ManBearPig | 1 Mar 2012 17:46 | 4 |
I don't understand, why only 96 authors got ac. Oh. May be you can help to other users get AC after your hint, your words about "only 98 authors" nobody will help. Author said very much for your! He said that there is strict ,simpe ans easy way for solution. It is not right any times. I used divide & conquer algo on vector of fractions. Can you show me an easier way? |