-
Notifications
You must be signed in to change notification settings - Fork 0
/
1510-3.html
1 lines (1 loc) · 73.9 KB
/
1510-3.html
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><HTML><HEAD><META http-equiv="Content-Type" content="text/html; charset=utf-8"><META NAME="viewport" CONTENT="width=768"><META HTTP-EQUIV="X-UA-Compatible" CONTENT="IE=edge"><TITLE>Discussion @ 1510. Order @ Timus Online Judge</TITLE><LINK REL="alternate" HREFLANG="x-default" HREF="/forum/?from=633232223822415000&style=tree&num=1510&space=1"><LINK REL="alternate" HREFLANG="en-us" HREF="/forum/?from=633232223822415000&style=tree&num=1510&space=1&locale=en"><LINK REL="alternate" HREFLANG="ru-ru" HREF="/forum/?from=633232223822415000&style=tree&num=1510&space=1&locale=ru"><LINK REL="stylesheet" TYPE="text/css" HREF="/style46.css"><LINK REL="shortcut icon" TYPE="image/x-icon" HREF="/favicon.ico"></HEAD><BODY ALINK="#1A5CC8" VLINK="#1A5CC8" LINK="#1A5CC8"><TABLE WIDTH="100%" CELLSPACING="0" CELLPADDING="0" CLASS="body"><TR><TD CLASS="caption"><TABLE WIDTH="100%" CELLSPACING="0" CELLPADDING="0"><TR><TD WIDTH="130" CLASS="locale"><A HREF="/forum/?from=633232223822415000&style=tree&num=1510&space=1&locale=en">ENG</A> <A HREF="/forum/?from=633232223822415000&style=tree&num=1510&space=1&locale=ru">RUS</A></TD><TD CLASS="title"><A HREF="/">Timus Online Judge</A></TD><TD WIDTH="130"></TD></TR></TABLE></TD></TR><TR><TD CLASS="panel"><TABLE WIDTH="100%" CELLSPACING="0" CELLPADDING="0"><TR><TD WIDTH="130" VALIGN="TOP" ALIGN="CENTER" STYLE="padding-bottom:5px;"><A HREF="/"><IMG BORDER="0" SRC="/images/usu-summer.jpg" HEIGHT="134" WIDTH="106" ALT=""></A></TD><TD VALIGN="TOP" ALIGN="LEFT"><TABLE WIDTH="100%" CELLSPACING="0" CELLPADDING="0" CLASS="panel"><TR><TH WIDTH="25%"><DIV>Online Judge</DIV></TH><TH WIDTH="25%"><DIV>Problems</DIV></TH><TH WIDTH="25%"><DIV>Authors</DIV></TH><TH WIDTH="25%"><DIV>Online contests</DIV></TH></TR><TR><TD VALIGN="TOP" ALIGN="LEFT"><A HREF="/">About Online Judge</A><BR><A HREF="/help.aspx?topic=faq">Frequently asked questions</A><BR><A HREF="/news.aspx">Site news</A><BR><A HREF="/forum/">Webboard</A><BR><A HREF="/help.aspx?topic=links">Links</A><BR></TD><TD VALIGN="TOP" ALIGN="LEFT"><A HREF="/problemset.aspx">Problem set</A><BR><A HREF="/submit.aspx">Submit solution</A><BR><A HREF="/status.aspx">Judge status</A><BR><A HREF="/help.aspx?topic=judge">Guide</A><BR></TD><TD VALIGN="TOP"><A HREF="/register.aspx">Register</A><BR><A HREF="/authedit.aspx">Update your info</A><BR><A HREF="/ranklist.aspx">Authors ranklist</A><BR><FORM ACTION="/search.aspx" METHOD="GET" STYLE="margin:0.6em 0em 0em 0em;"><INPUT NAME="Str" SIZE="12" VALUE="" PLACEHOLDER="Author’s name"> <INPUT TYPE="SUBMIT" VALUE="Search"></FORM></TD><TD VALIGN="TOP"><A HREF="/contest.aspx">Current contest</A><BR><A HREF="/schedule.aspx">Scheduled contests</A><BR><A HREF="/archive.aspx">Past contests</A><BR><A HREF="/help.aspx?topic=contest">Rules</A><BR></TD></TR></TABLE></TD></TR></TABLE></TD></TR><TR><TD STYLE="padding-top: 32px; padding-bottom: 20px;"><SCRIPT SRC="forum.js" TYPE="text/javascript"></SCRIPT><TABLE ALIGN="CENTER" CELLSPACING="0" CELLPADDING="0"><TR><TD WIDTH="1100"><H2 ALIGN="CENTER" STYLE="color: #1A5CC8">Discussion of Problem <A HREF="/problem.aspx?space=1&num=1510">1510<SPAN CLASS="problemname">. Order</SPAN></A></H2><DIV CLASS="messages board" STYLE="margin-right: 0px; width:100%" ALIGN="CENTER" ID="ForumBoard"><FORM ACTION="" METHOD="POST" ID="threadsform"><INPUT TYPE="HIDDEN" NAME="Action" VALUE="" ID="threadsformaction"><TABLE WIDTH="100%" CELLSPACING="0" CELLPADDING="2" BORDER="0" CLASS="board"><TR BGCOLOR="#F0F0F0"><TD ALIGN="LEFT" COLSPAN="5"><A HREF="javascript:ShowThreads()">Show all threads</A> <A HREF="javascript:HideThreads()">Hide all threads</A> <A HREF="javascript:ShowMessages()">Show all messages</A> <A HREF="javascript:HideMessages()">Hide all messages</A></TD></TR><TR CLASS="forum1"><TD CLASS="forum_tree_subject"><A HREF="javascript:Show('19094', '633232223822415000')" ID="Img19094" CLASS="forumimg forumimg-plus forum_text_icon">WA#9 ! </A></TD><TD CLASS="forum_tree_author"><A HREF="/author.aspx?id=56123">TimoX</A></TD><TD CLASS="forum_tree_problem"><A HREF="/problem.aspx?space=1&num=1510">1510<SPAN CLASS="problemname">. Order</SPAN></A></TD><TD CLASS="forum_tree_date">20 Aug 2007 15:59</TD><TD CLASS="forum_tree_count">3 </TD></TR><TR><TD ALIGN="LEFT" COLSPAN="5" STYLE="padding:0px 2px;"><DIV ID="19094" CLASS="hidden_thread" STYLE="display:none;"><DIV CLASS="thread"><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633230595973508750')" ID="Img633230595973508750" CLASS="forumimg forumimg-msg_minus forum_text_icon">WA#9 !</A> <B>TimoX</B> <SPAN CLASS="treedate">18 Aug 2007 18:46</SPAN></DIV><DIV ID="633230595973508750" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">I thing in this problem impossible get WA.<BR>TLE I understand. But...<BR>What wrong.<BR>I use Qsort and dihotomy.<BR>Can anyone give me some interesting tests?<BR>Thank's!<BR>;)</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=19094&reply=633230595973508750"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633231816524133750')" ID="Img633231816524133750" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: WA#9 !</A> <B>Stanislav Prigodich</B> <SPAN CLASS="treedate">20 Aug 2007 04:40</SPAN></DIV><DIV ID="633231816524133750" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">I have a one question.<BR>What here does dichotomy?<BR>It here is not necessary :)<BR>Maybe you don't understand this task?<BR>Try to read again ;)</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=19094&reply=633231816524133750"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633232223822415000')" ID="Img633232223822415000" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: WA#9 !</A> <B>TimoX</B> <SPAN CLASS="treedate">20 Aug 2007 15:59</SPAN></DIV><DIV ID="633232223822415000" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">Thank you, Stas!<BR>Now I've got AC.<BR>In my first solution I use binary find[why not dichotomy?!]<BR>But after getting TLE, i see next - "More than half of them are the same."<BR>:)<BR>It's really fanny task!</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=19094&reply=633232223822415000"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></TD></TR><TR CLASS="forum0"><TD CLASS="forum_tree_subject"><A HREF="javascript:Show('19090', '633230425378040000')" ID="Img19090" CLASS="forumimg forumimg-plus forum_text_icon">WA #4 my code is here</A></TD><TD CLASS="forum_tree_author"><A HREF="/author.aspx?id=51907">Jerry</A></TD><TD CLASS="forum_tree_problem"><A HREF="/problem.aspx?space=1&num=1510">1510<SPAN CLASS="problemname">. Order</SPAN></A></TD><TD CLASS="forum_tree_date">18 Aug 2007 14:02</TD><TD CLASS="forum_tree_count">3 </TD></TR><TR><TD ALIGN="LEFT" COLSPAN="5" STYLE="padding:0px 2px;"><DIV ID="19090" CLASS="hidden_thread" STYLE="display:none;"><DIV CLASS="thread"><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633230262684602500')" ID="Img633230262684602500" CLASS="forumimg forumimg-msg_minus forum_text_icon">WA #4 my code is here</A> <B>Jerry</B> <SPAN CLASS="treedate">18 Aug 2007 09:31</SPAN></DIV><DIV ID="633230262684602500" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">#include<iostream><BR>#include<algorithm><BR>using namespace std;<BR>int used[500000]={0};<BR>bool cmp(int a,int b)<BR>{<BR> return (a>b);<BR>}<BR>int main (void)<BR>{<BR> int N;<BR> cin>>N;<BR> for (int k=0;k<N;k++)<BR> {<BR> int f;<BR> cin>>f;<BR> used[f]++;<BR> }<BR> sort (used,used+500000,cmp);<BR> cout<<used[0]<<endl;<BR> return 0;<BR>}</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=19090&reply=633230262684602500"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633230266115852500')" ID="Img633230266115852500" CLASS="forumimg forumimg-msg_minus forum_text_icon">WA#7 After fixed</A> <B>Jerry</B> <SPAN CLASS="treedate">18 Aug 2007 09:36</SPAN></DIV><DIV ID="633230266115852500" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">WA#7 After fixed<BR>#include<iostream><BR>#include<algorithm><BR>using namespace std;<BR>struct note<BR>{<BR> int value;<BR> int rank;<BR>};<BR>note used[500000]={0};<BR>bool cmp(note a,note b)<BR>{<BR> return (a.rank>b.rank);<BR>}<BR>int main (void)<BR>{<BR> int N,j=0;<BR> cin>>N;<BR> for (int k=0;k<N;k++)<BR> {<BR> bool zepo=false;<BR> int f;<BR> cin>>f;<BR> for (int i=0;i<j;i++)<BR> if (used[i].value==f)<BR> {<BR> used[i].rank++;<BR> zepo=true;<BR> }<BR> if (!zepo)<BR> {<BR> used[j].value=f;<BR> used[j].rank=1;<BR> }<BR> }<BR> sort (used,used+j,cmp);<BR> cout<<used[0].value<<endl;<BR> //cin>>j;<BR> return 0;<BR>}</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=19090&reply=633230266115852500"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633230425378040000')" ID="Img633230425378040000" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: WA#7 After fixed</A> <B>CHIDEMYAN SERGEY</B> <SPAN CLASS="treedate">18 Aug 2007 14:02</SPAN></DIV><DIV ID="633230425378040000" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">It's so big...Just create a dynamic array,sort it by sort() function and output n/2-th element of array.Good luck!<BR> <BR><I>Edited by author 18.08.2007 14:02</I></DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=19090&reply=633230425378040000"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></TD></TR><TR CLASS="forum1"><TD CLASS="forum_tree_subject"><A HREF="javascript:Show('18929', '633191213486602500')" ID="Img18929" CLASS="forumimg forumimg-plus forum_text_icon">wa#13((((</A></TD><TD CLASS="forum_tree_author"><A HREF="/author.aspx?id=38117">Ras Misha [t4ce]</A></TD><TD CLASS="forum_tree_problem"><A HREF="/problem.aspx?space=1&num=1510">1510<SPAN CLASS="problemname">. Order</SPAN></A></TD><TD CLASS="forum_tree_date">4 Jul 2007 04:49</TD><TD CLASS="forum_tree_count">1 </TD></TR><TR><TD ALIGN="LEFT" COLSPAN="5" STYLE="padding:0px 2px;"><DIV ID="18929" CLASS="hidden_thread" STYLE="display:none;"><DIV CLASS="thread"><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633191213486602500')" ID="Img633191213486602500" CLASS="forumimg forumimg-msg_minus forum_text_icon">wa#13((((</A> <B>Ras Misha [t4ce]</B> <SPAN CLASS="treedate">4 Jul 2007 04:49</SPAN></DIV><DIV ID="633191213486602500" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">i can't understand what is wrong(((<BR> <BR>var<BR>k:array[1..3] of integer;<BR>t:array[1..3] of integer;<BR>kt:byte=0;<BR>c,i,n:integer;<BR>begin<BR>readln(n);<BR>if n<3 then begin readln(c); writeln(c); end else<BR>begin<BR>kt:=0;<BR>for i:=1 to 3 do t[i]:=0;<BR>for i:=1 to n do<BR> begin<BR> read(c);<BR> if kt<3 then<BR> begin<BR> if kt=0 then begin t[1]:=c; inc(kt); end else<BR> begin<BR> if (kt=1) and (t[1]<>c) then<BR> begin<BR> inc(kt);<BR> t[2]:=c;<BR> end;<BR> if (kt=2) and (t[1]<>c) and (t[2]<>c) then<BR> begin<BR> inc(kt);<BR> t[3]:=c;<BR> end;<BR> end;<BR> end;<BR> if c=t[1] then inc(k[1]);<BR> if c=t[2] then inc(k[2]);<BR> if c=t[3] then inc(k[3]);<BR> end;<BR>c:=1;<BR>n:=k[1];<BR>for i:=2 to 3 do<BR> if k[i]>n then<BR> begin<BR> c:=i;<BR> n:=k[i];<BR> end;<BR>writeln(t[c]);<BR>end;<BR>{if k[1]>n div 2 then writeln(t[1]);<BR>if k[2]>n div 2 then writeln(t[2]);<BR>if k[3]>n div 2 then writeln(t[3]);<BR>readln;}<BR>end.</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=18929&reply=633191213486602500"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV></DIV></DIV></DIV></TD></TR><TR CLASS="forum0"><TD CLASS="forum_tree_subject"><A HREF="javascript:Show('15411', '633156267428098750')" ID="Img15411" CLASS="forumimg forumimg-plus forum_text_icon">WA #2</A></TD><TD CLASS="forum_tree_author"><A HREF="/author.aspx?id=52072">Rafal</A></TD><TD CLASS="forum_tree_problem"><A HREF="/problem.aspx?space=1&num=1510">1510<SPAN CLASS="problemname">. Order</SPAN></A></TD><TD CLASS="forum_tree_date">24 May 2007 18:05</TD><TD CLASS="forum_tree_count">1 </TD></TR><TR><TD ALIGN="LEFT" COLSPAN="5" STYLE="padding:0px 2px;"><DIV ID="15411" CLASS="hidden_thread" STYLE="display:none;"><DIV CLASS="thread"><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633156267428098750')" ID="Img633156267428098750" CLASS="forumimg forumimg-msg_minus forum_text_icon">WA #2</A> <B>Rafal</B> <SPAN CLASS="treedate">24 May 2007 18:05</SPAN></DIV><DIV ID="633156267428098750" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">Hi.<BR>I have WA on test #2. Can you post some samples? Thanks.</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=15411&reply=633156267428098750"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV></DIV></DIV></DIV></TD></TR><TR CLASS="forum1"><TD CLASS="forum_tree_subject"><A HREF="javascript:Show('14987', '633099260525397500')" ID="Img14987" CLASS="forumimg forumimg-plus forum_text_icon">PLEASE,HELP ME!!!!!!!!!!!!!!!!!! I HAVE 2 PROGRAMM!!!!!!!!ONE OF THEM TLE#19,ANOTHER TLE#20 </A></TD><TD CLASS="forum_tree_author"><A HREF="/author.aspx?id=51633">CHIDEMYAN SERGEY</A></TD><TD CLASS="forum_tree_problem"><A HREF="/problem.aspx?space=1&num=1510">1510<SPAN CLASS="problemname">. Order</SPAN></A></TD><TD CLASS="forum_tree_date">19 Mar 2007 18:34</TD><TD CLASS="forum_tree_count">19 </TD></TR><TR><TD ALIGN="LEFT" COLSPAN="5" STYLE="padding:0px 2px;"><DIV ID="14987" CLASS="hidden_thread" STYLE="display:none;"><DIV CLASS="thread"><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633095025151337500')" ID="Img633095025151337500" CLASS="forumimg forumimg-msg_minus forum_text_icon">PLEASE,HELP ME!!!!!!!!!!!!!!!!!! I HAVE 2 PROGRAMM!!!!!!!!ONE OF THEM TLE#19,ANOTHER TLE#20</A> <B>CHIDEMYAN SERGEY</B> <SPAN CLASS="treedate">14 Mar 2007 20:55</SPAN></DIV><DIV ID="633095025151337500" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right"><I>Edited by author 17.03.2007 22:05</I><BR> <BR><I>Edited by author 17.03.2007 22:05</I><BR> <BR><I>Edited by author 17.03.2007 22:49</I></DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14987&reply=633095025151337500"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633097684913993750')" ID="Img633097684913993750" CLASS="forumimg forumimg-msg_minus forum_text_icon">HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</A> <B>CHIDEMYAN SERGEY</B> <SPAN CLASS="treedate">17 Mar 2007 22:48</SPAN></DIV><DIV ID="633097684913993750" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right"> <BR> <BR><I>Edited by author 19.03.2007 18:44</I></DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14987&reply=633097684913993750"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633097716627900000')" ID="Img633097716627900000" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</A> <B>Romko [Lviv NU]</B> <SPAN CLASS="treedate">17 Mar 2007 23:41</SPAN></DIV><DIV ID="633097716627900000" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">Your program is O(n^2). But you can write simple quick sort(O(n*log(n))) and got AC!!!</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14987&reply=633097716627900000"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633097721169618750')" ID="Img633097721169618750" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</A> <B>CHIDEMYAN SERGEY</B> <SPAN CLASS="treedate">17 Mar 2007 23:48</SPAN></DIV><DIV ID="633097721169618750" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">SORRY!IM BEGINNER,AND I SHALL VERY PLEASED TO YOU IF YOU SAY ME WHAT IT MEANS O(n*log(n))) OR O(n^2). THANK!!!!<BR> <BR><I>Edited by author 17.03.2007 23:49</I></DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14987&reply=633097721169618750"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633097760668212500')" ID="Img633097760668212500" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</A> <B>CHIDEMYAN SERGEY</B> <SPAN CLASS="treedate">18 Mar 2007 00:54</SPAN></DIV><DIV ID="633097760668212500" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">I think I found book about quick sort<BR> <BR><I>Edited by author 18.03.2007 00:54</I></DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14987&reply=633097760668212500"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633097774879306250')" ID="Img633097774879306250" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</A> <B>CHIDEMYAN SERGEY</B> <SPAN CLASS="treedate">18 Mar 2007 01:18</SPAN></DIV><DIV ID="633097774879306250" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">It so hard????</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14987&reply=633097774879306250"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633097820260087500')" ID="Img633097820260087500" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</A> <B>KIRILL(ArcSTU)</B> <SPAN CLASS="treedate">18 Mar 2007 02:33</SPAN></DIV><DIV ID="633097820260087500" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">No :)<BR>Qsort is standart sorting algo<BR>you should not understand how it's work deeply just<BR>use it when you need(copypost:) or use included in C++<BR> <BR>by the way this problem can be solved in O(n)<BR>if you post your mail I can send you several variants<BR> <BR>P.S.<BR>O() is complexity of algo<BR>shortly to say<BR>for example<BR> <BR>for i:=1 to n do ... O(n)<BR> <BR>for i:=1 to n do<BR>for j:=1 to n do ... O(n^2)<BR> <BR>but it's very stupid definition:)<BR> <BR><I>Edited by author 18.03.2007 02:37</I></DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14987&reply=633097820260087500"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633098239546493750')" ID="Img633098239546493750" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</A> <B>Romko [Lviv NU]</B> <SPAN CLASS="treedate">18 Mar 2007 14:12</SPAN></DIV><DIV ID="633098239546493750" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">Why O(n), I think it's O(2*n)!!!</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14987&reply=633098239546493750"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633098285958993750')" ID="Img633098285958993750" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</A> <B>KIRILL(ArcSTU)</B> <SPAN CLASS="treedate">18 Mar 2007 15:29</SPAN></DIV><DIV ID="633098285958993750" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right"><DIV CLASS="forum_quote_header"><B>Romko [Lviv NU]</B> wrote 18 March 2007 14:12</DIV><DIV CLASS="forum_quote">Why O(n), I think it's O(2*n)!!!</DIV>:)<BR> <BR>O(2*n)= O(3*n)=O(100000000000000000*n) = O(n)<BR>constant is not uses with n in O<BR> <BR>so with small n sometimes O(N^2) solutions work faster then<BR>O(n) because of constant<BR> <BR> <BR>my O(n) is only 1 cycle for input for i:=1 to n</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14987&reply=633098285958993750"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633098464581689815')" ID="Img633098464581689815" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</A> <B>CHIDEMYAN SERGEY</B> <SPAN CLASS="treedate">18 Mar 2007 20:27</SPAN></DIV><DIV ID="633098464581689815" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">MY mail:serchch@mail.ru!THANK YOU VERY much!YOU HELP me second time!!!!THANK YOU!!!!!!!!</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14987&reply=633098464581689815"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633099191281491250')" ID="Img633099191281491250" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</A> <B>CHIDEMYAN SERGEY</B> <SPAN CLASS="treedate">19 Mar 2007 16:38</SPAN></DIV><DIV ID="633099191281491250" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">IS QSORT FUNCTION USE IN <ALGORITHM>?<BR> <BR><I>Edited by author 19.03.2007 17:50</I></DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14987&reply=633099191281491250"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633099234046335000')" ID="Img633099234046335000" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</A> <B>CHIDEMYAN SERGEY</B> <SPAN CLASS="treedate">19 Mar 2007 17:50</SPAN></DIV><DIV ID="633099234046335000" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right"></DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14987&reply=633099234046335000"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633099241597428750')" ID="Img633099241597428750" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</A> <B>Romko [Lviv NU]</B> <SPAN CLASS="treedate">19 Mar 2007 18:02</SPAN></DIV><DIV ID="633099241597428750" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">YES.<BR>int a[100];<BR>sort(a,a+100);</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14987&reply=633099241597428750"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633099248617585000')" ID="Img633099248617585000" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</A> <B>CHIDEMYAN SERGEY</B> <SPAN CLASS="treedate">19 Mar 2007 18:14</SPAN></DIV><DIV ID="633099248617585000" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right"> <BR> <BR><I>Edited by author 19.03.2007 18:43</I><BR> <BR><I>Edited by author 19.03.2007 18:43</I></DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14987&reply=633099248617585000"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633099249775710000')" ID="Img633099249775710000" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</A> <B>Romko [Lviv NU]</B> <SPAN CLASS="treedate">19 Mar 2007 18:16</SPAN></DIV><DIV ID="633099249775710000" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">My algo is the same :)<BR>[DELETED]<BR> <BR><I>Edited by author 19.03.2007 18:34</I></DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14987&reply=633099249775710000"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633099254294303750')" ID="Img633099254294303750" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</A> <B>CHIDEMYAN SERGEY</B> <SPAN CLASS="treedate">19 Mar 2007 18:23</SPAN></DIV><DIV ID="633099254294303750" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">SORRY!CAN YOU SAY WHAT MEANS MALLOC?THANK!!!!<BR> <BR><I>Edited by author 19.03.2007 18:24</I></DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14987&reply=633099254294303750"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633099256404928750')" ID="Img633099256404928750" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</A> <B>Romko [Lviv NU]</B> <SPAN CLASS="treedate">19 Mar 2007 18:27</SPAN></DIV><DIV ID="633099256404928750" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">char *t;<BR>t = (char*)malloc(sizeof(char)*10);<BR>equal to<BR>char *t = new char[10];</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14987&reply=633099256404928750"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633099259472116250')" ID="Img633099259472116250" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</A> <B>CHIDEMYAN SERGEY</B> <SPAN CLASS="treedate">19 Mar 2007 18:32</SPAN></DIV><DIV ID="633099259472116250" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">THANK!!!NOW I UNDERSTAND!</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14987&reply=633099259472116250"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633099260525397500')" ID="Img633099260525397500" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: HERE IS MY 2 SOLUTIONS.ONE OF THEM TLE#19,ANOTHER TLE#20!!!!!!!!!!!!!PLEASE HELP ME!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!</A> <B>Romko [Lviv NU]</B> <SPAN CLASS="treedate">19 Mar 2007 18:34</SPAN></DIV><DIV ID="633099260525397500" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">:)</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14987&reply=633099260525397500"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></TD></TR><TR CLASS="forum0"><TD CLASS="forum_tree_subject"><A HREF="javascript:Show('15028', '633099125665929015')" ID="Img15028" CLASS="forumimg forumimg-plus forum_text_icon">why its' wrong help me</A></TD><TD CLASS="forum_tree_author"><A HREF="/author.aspx?id=53459">olzii</A></TD><TD CLASS="forum_tree_problem"><A HREF="/problem.aspx?space=1&num=1510">1510<SPAN CLASS="problemname">. Order</SPAN></A></TD><TD CLASS="forum_tree_date">19 Mar 2007 14:49</TD><TD CLASS="forum_tree_count">1 </TD></TR><TR><TD ALIGN="LEFT" COLSPAN="5" STYLE="padding:0px 2px;"><DIV ID="15028" CLASS="hidden_thread" STYLE="display:none;"><DIV CLASS="thread"><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633099125665929015')" ID="Img633099125665929015" CLASS="forumimg forumimg-msg_minus forum_text_icon">why its' wrong help me</A> <B>olzii</B> <SPAN CLASS="treedate">19 Mar 2007 14:49</SPAN></DIV><DIV ID="633099125665929015" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">var<BR>b,a:array[1..100] of string;<BR>x,l,w,n,i,j:integer;<BR>begin<BR> assign(input,'fac.in');reset(input);<BR> assign(output,'fac.out');rewrite(output);<BR> readln(n);<BR> for i:=1 to n do<BR> readln(a[i]);<BR> for i:=1 to n do<BR> for j:=i+1 to n do<BR> begin<BR> if (a[i]=a[j]) and (a[i]<>'0') and (a[j]<>'0') then<BR> begin<BR> x:=x+1;<BR> b[x]:=a[i];<BR> for l:=1 to n do<BR> if b[x]=a[l] then a[l]:='0';<BR> end;<BR> end;<BR> for i:=1 to x do writeln(b[i]);<BR> <BR> close(input);close(output);<BR>end.<BR> <BR><I>Edited by author 19.03.2007 14:49</I></DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=15028&reply=633099125665929015"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV></DIV></DIV></DIV></TD></TR><TR CLASS="forum1"><TD CLASS="forum_tree_subject"><A HREF="javascript:Show('14985', '633095745442431250')" ID="Img14985" CLASS="forumimg forumimg-plus forum_text_icon">PROBLEM WITH A PROBLEM</A></TD><TD CLASS="forum_tree_author"><A HREF="/author.aspx?id=45322">Alex TKTL</A></TD><TD CLASS="forum_tree_problem"><A HREF="/problem.aspx?space=1&num=1510">1510<SPAN CLASS="problemname">. Order</SPAN></A></TD><TD CLASS="forum_tree_date">15 Mar 2007 16:55</TD><TD CLASS="forum_tree_count">4 </TD></TR><TR><TD ALIGN="LEFT" COLSPAN="5" STYLE="padding:0px 2px;"><DIV ID="14985" CLASS="hidden_thread" STYLE="display:none;"><DIV CLASS="thread"><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633094937014306250')" ID="Img633094937014306250" CLASS="forumimg forumimg-msg_minus forum_text_icon">PROBLEM WITH A PROBLEM</A> <B>Alex TKTL</B> <SPAN CLASS="treedate">14 Mar 2007 18:28</SPAN></DIV><DIV ID="633094937014306250" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">Why this source got WA#13<BR> <BR>var a:array[1..5000]of longint;<BR>n,k,i,j,l,r,mid,com,cout:longint;<BR>procedure sort(l,r: longint);<BR>var<BR>i,j,x,y: longint;<BR>begin i:=l; j:=r; x:=a[(l+r) DIV 2];<BR>repeat<BR>while a[i]<x do i:=i+1;<BR>while x<a[j] do j:=j-1;<BR>if i<=j then<BR>begin y:=a[i]; a[i]:=a[j]; a[j]:=y;<BR>i:=i+1; j:=j-1;<BR>end;<BR>until i>j;<BR>if l<j then sort(l,j);<BR>if i<r then sort(i,r);<BR>end;<BR>begin read(n);<BR>for i:=1 to n do<BR>read(a[i]);<BR>sort(1,n);<BR>mid:=-maxlongint;<BR>cout:=1; com:=0;<BR>for i:=2 to n do<BR>if a[i]=a[i-1] then inc(cout)<BR>else if cout>mid then<BR>begin mid:=cout;<BR>cout:=1;<BR>com:=a[i-1];<BR>end;<BR>if ((com=0)and(n>0)) then com:=a[1]<BR>else<BR>if (mid<cout) then com:=a[n]<BR>else<BR>if ((com=0)and(n=0)) then com:=0;<BR> <BR>write(com);<BR>end.<BR> <BR><I>Edited by author 16.03.2007 10:55</I></DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14985&reply=633094937014306250"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633094937540087500')" ID="Img633094937540087500" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: PROBLEM WITH A PROBLEM</A> <B>Romko [Lviv NU]</B> <SPAN CLASS="treedate">14 Mar 2007 18:29</SPAN></DIV><DIV ID="633094937540087500" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">3 of course</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14985&reply=633094937540087500"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633095597071181250')" ID="Img633095597071181250" CLASS="forumimg forumimg-msg_minus forum_text_icon">No subject</A> <B>Alex TKTL</B> <SPAN CLASS="treedate">15 Mar 2007 12:48</SPAN></DIV><DIV ID="633095597071181250" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right"> <BR> <BR><I>Edited by author 16.03.2007 10:54</I></DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14985&reply=633095597071181250"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633095745442431250')" ID="Img633095745442431250" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: Why</A> <B>Shady TKTL</B> <SPAN CLASS="treedate">15 Mar 2007 16:55</SPAN></DIV><DIV ID="633095745442431250" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right"> <BR> <BR><I>Edited by author 16.03.2007 10:56</I></DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14985&reply=633095745442431250"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></TD></TR><TR CLASS="forum0"><TD CLASS="forum_tree_subject"><A HREF="javascript:Show('14013', '633093814031650000')" ID="Img14013" CLASS="forumimg forumimg-plus forum_text_icon">Can anyone post test 5 ?</A></TD><TD CLASS="forum_tree_author"><A HREF="/author.aspx?id=40782">Nurbek</A></TD><TD CLASS="forum_tree_problem"><A HREF="/problem.aspx?space=1&num=1510">1510<SPAN CLASS="problemname">. Order</SPAN></A></TD><TD CLASS="forum_tree_date">13 Mar 2007 11:16</TD><TD CLASS="forum_tree_count">13 </TD></TR><TR><TD ALIGN="LEFT" COLSPAN="5" STYLE="padding:0px 2px;"><DIV ID="14013" CLASS="hidden_thread" STYLE="display:none;"><DIV CLASS="thread"><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('632977280769816250')" ID="Img632977280769816250" CLASS="forumimg forumimg-msg_minus forum_text_icon">Can anyone post test 5 ?</A> <B>Nurbek</B> <SPAN CLASS="treedate">29 Oct 2006 14:14</SPAN></DIV><DIV ID="632977280769816250" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right"></DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14013&reply=632977280769816250"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('632977282014035000')" ID="Img632977282014035000" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: Can anyone post test 5 ?</A> <B>tester</B> <SPAN CLASS="treedate">29 Oct 2006 14:16</SPAN></DIV><DIV ID="632977282014035000" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">maybe like this....<BR> <BR>5<BR>1 2 3 4 5<BR> <BR>or<BR> <BR>1<BR>1<BR> <BR>or<BR> <BR>5<BR>1 1 1 1 1</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14013&reply=632977282014035000"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('632977289107941250')" ID="Img632977289107941250" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: Can anyone post test 5 ?</A> <B>Nurbek</B> <SPAN CLASS="treedate">29 Oct 2006 14:28</SPAN></DIV><DIV ID="632977289107941250" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">Does each answer in your tests equal to 1 ?<BR> <BR><I>Edited by author 29.10.2006 14:28</I></DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14013&reply=632977289107941250"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('632977290645597500')" ID="Img632977290645597500" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: Can anyone post test 5 ?</A> <B>tester</B> <SPAN CLASS="treedate">29 Oct 2006 14:31</SPAN></DIV><DIV ID="632977290645597500" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">yes.<BR> <BR>paste your code here.later delete.</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14013&reply=632977290645597500"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('632977291472785000')" ID="Img632977291472785000" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: OK</A> <B>Nurbek</B> <SPAN CLASS="treedate">29 Oct 2006 14:32</SPAN></DIV><DIV ID="632977291472785000" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right"> <BR> <BR><I>Edited by author 29.10.2006 14:50</I></DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14013&reply=632977291472785000"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('632977293582160000')" ID="Img632977293582160000" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: OK</A> <B>tester</B> <SPAN CLASS="treedate">29 Oct 2006 14:35</SPAN></DIV><DIV ID="632977293582160000" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">ohhhh.your solution incorrect.because<BR>0 ≤ K ≤ 1000000000<BR> <BR>check this test<BR>4<BR>10000000 10000001 10000001 100000002<BR> <BR>answer:10000001</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14013&reply=632977293582160000"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('632977296967628750')" ID="Img632977296967628750" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: OK</A> <B>Nurbek</B> <SPAN CLASS="treedate">29 Oct 2006 14:41</SPAN></DIV><DIV ID="632977296967628750" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">It gives error, shouldn't longint include all of this data ?</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14013&reply=632977296967628750"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('632977298613878750')" ID="Img632977298613878750" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: OK</A> <B>tester</B> <SPAN CLASS="treedate">29 Oct 2006 14:44</SPAN></DIV><DIV ID="632977298613878750" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">begin<BR>read(u); here>> 0 ≤ U ≤ 1000000000 and your array z:array[0..500000] of longint;<BR> <BR>inc(z[u]);<BR>end;<BR> <BR>use quicksort.</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14013&reply=632977298613878750"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('632977301521066250')" ID="Img632977301521066250" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: OK</A> <B>Nurbek</B> <SPAN CLASS="treedate">29 Oct 2006 14:49</SPAN></DIV><DIV ID="632977301521066250" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">Thanx a lot!!! I picked up a wrong solution way !!!</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14013&reply=632977301521066250"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633093373644462500')" ID="Img633093373644462500" CLASS="forumimg forumimg-msg_minus forum_text_icon">tests of tester</A> <B>Molochiy Ivan[ Lviv NU ]</B> <SPAN CLASS="treedate">12 Mar 2007 23:02</SPAN></DIV><DIV ID="633093373644462500" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">the answer on test<BR> <BR>4<BR>10000000<BR>10000001<BR>10000001<BR>100000002<BR> <BR>is 100000002</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14013&reply=633093373644462500"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633093381158993750')" ID="Img633093381158993750" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: tests of tester</A> <B>Romko [Lviv NU]</B> <SPAN CLASS="treedate">12 Mar 2007 23:15</SPAN></DIV><DIV ID="633093381158993750" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">Are you sure??? Read problem statement more carefuly. You should to output the majority element of this array[it's element which meeting in array more then n/2 times], so the majority element in your sample is 10000001.</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14013&reply=633093381158993750"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('632977295454816250')" ID="Img632977295454816250" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: Can anyone post test 5 ?</A> <B>Spieler (USU)</B> <SPAN CLASS="treedate">29 Oct 2006 14:39</SPAN></DIV><DIV ID="632977295454816250" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">Test "5 1 2 3 4 5" is incorrect!</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14013&reply=632977295454816250"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633093814031650000')" ID="Img633093814031650000" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: Can anyone post test 5 ?</A> <B>Logic</B> <SPAN CLASS="treedate">13 Mar 2007 11:16</SPAN></DIV><DIV ID="633093814031650000" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">hi Nurbek where do you study ?<BR>which ktl ?</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14013&reply=633093814031650000"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV></DIV></DIV></DIV></DIV></TD></TR><TR CLASS="forum1"><TD CLASS="forum_tree_subject"><A HREF="javascript:Show('14970', '633093350665712500')" ID="Img14970" CLASS="forumimg forumimg-plus forum_text_icon">Quick Algo ! ? ! ? ! ? </A></TD><TD CLASS="forum_tree_author"><A HREF="/author.aspx?id=52429">Shady TKTL</A></TD><TD CLASS="forum_tree_problem"><A HREF="/problem.aspx?space=1&num=1510">1510<SPAN CLASS="problemname">. Order</SPAN></A></TD><TD CLASS="forum_tree_date">12 Mar 2007 22:24</TD><TD CLASS="forum_tree_count">3 </TD></TR><TR><TD ALIGN="LEFT" COLSPAN="5" STYLE="padding:0px 2px;"><DIV ID="14970" CLASS="hidden_thread" STYLE="display:none;"><DIV CLASS="thread"><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633093343386650000')" ID="Img633093343386650000" CLASS="forumimg forumimg-msg_minus forum_text_icon">Quick Algo ! ? ! ? ! ?</A> <B>Shady TKTL</B> <SPAN CLASS="treedate">12 Mar 2007 22:12</SPAN></DIV><DIV ID="633093343386650000" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">I think like that<BR>Firstly, I must use count sort or heap sort?<BR>Then count maximal number and write it.<BR> <BR>Am I right?</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14970&reply=633093343386650000"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633093349275243750')" ID="Img633093349275243750" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: Quick Algo ! ? ! ? ! ?</A> <B>KIRILL(ArcSTU)</B> <SPAN CLASS="treedate">12 Mar 2007 22:22</SPAN></DIV><DIV ID="633093349275243750" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">The simplest way is Qsort and out mas[n div 2] O(n*lgn)<BR>Read other thread for fast O(n)</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14970&reply=633093349275243750"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633093350665712500')" ID="Img633093350665712500" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: Quick Algo ! ? ! ? ! ?</A> <B>Shady TKTL</B> <SPAN CLASS="treedate">12 Mar 2007 22:24</SPAN></DIV><DIV ID="633093350665712500" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">Thanks to you KIRILL(ArcSTU)</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14970&reply=633093350665712500"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></TD></TR><TR CLASS="forum0"><TD CLASS="forum_tree_subject"><A HREF="javascript:Show('14658', '633060979867348750')" ID="Img14658" CLASS="forumimg forumimg-plus forum_text_icon">Heap solves all the problems!!!</A></TD><TD CLASS="forum_tree_author"><A HREF="/author.aspx?id=50102">Dan.hu</A></TD><TD CLASS="forum_tree_problem"><A HREF="/problem.aspx?space=1&num=1510">1510<SPAN CLASS="problemname">. Order</SPAN></A></TD><TD CLASS="forum_tree_date">3 Feb 2007 11:13</TD><TD CLASS="forum_tree_count">1 </TD></TR><TR><TD ALIGN="LEFT" COLSPAN="5" STYLE="padding:0px 2px;"><DIV ID="14658" CLASS="hidden_thread" STYLE="display:none;"><DIV CLASS="thread"><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633060979867348750')" ID="Img633060979867348750" CLASS="forumimg forumimg-msg_minus forum_text_icon">Heap solves all the problems!!!</A> <B>Dan.hu</B> <SPAN CLASS="treedate">3 Feb 2007 11:13</SPAN></DIV><DIV ID="633060979867348750" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right"></DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14658&reply=633060979867348750"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV></DIV></DIV></DIV></TD></TR><TR CLASS="forum1"><TD CLASS="forum_tree_subject"><A HREF="javascript:Show('14234', '633011683087360000')" ID="Img14234" CLASS="forumimg forumimg-plus forum_text_icon">WA # 13. Need help</A></TD><TD CLASS="forum_tree_author"><A HREF="/author.aspx?id=47750">KBTU_10</A></TD><TD CLASS="forum_tree_problem"><A HREF="/problem.aspx?space=1&num=1510">1510<SPAN CLASS="problemname">. Order</SPAN></A></TD><TD CLASS="forum_tree_date">8 Dec 2006 09:51</TD><TD CLASS="forum_tree_count">2 </TD></TR><TR><TD ALIGN="LEFT" COLSPAN="5" STYLE="padding:0px 2px;"><DIV ID="14234" CLASS="hidden_thread" STYLE="display:none;"><DIV CLASS="thread"><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633011680285953750')" ID="Img633011680285953750" CLASS="forumimg forumimg-msg_minus forum_text_icon">WA # 13. Need help</A> <B>KBTU_10</B> <SPAN CLASS="treedate">8 Dec 2006 09:47</SPAN></DIV><DIV ID="633011680285953750" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">I'm getting WA on 13th test.<BR> What's wrong with that test?<BR> I urgently need help. At least, I amnot getting TL.</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14234&reply=633011680285953750"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633011683087360000')" ID="Img633011683087360000" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: WA # 13. Need help</A> <B>KBTU_10</B> <SPAN CLASS="treedate">8 Dec 2006 09:51</SPAN></DIV><DIV ID="633011683087360000" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">By the way, are there only 3 banknotes? Maybe test is not correct. And according to conditions of this problem, a number of some of them should be >= ( n / 2 ) if n = even;<BR>and > (n + 1) / 2 if n = odd. Is it right?</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14234&reply=633011683087360000"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV></DIV></DIV></DIV></DIV></TD></TR><TR CLASS="forum0"><TD CLASS="forum_tree_subject"><A HREF="javascript:Show('14226', '633011296801578750')" ID="Img14226" CLASS="forumimg forumimg-plus forum_text_icon">Crash</A></TD><TD CLASS="forum_tree_author"><A HREF="/author.aspx?id=50346">lamer2</A></TD><TD CLASS="forum_tree_problem"><A HREF="/problem.aspx?space=1&num=1510">1510<SPAN CLASS="problemname">. Order</SPAN></A></TD><TD CLASS="forum_tree_date">7 Dec 2006 23:08</TD><TD CLASS="forum_tree_count">2 </TD></TR><TR><TD ALIGN="LEFT" COLSPAN="5" STYLE="padding:0px 2px;"><DIV ID="14226" CLASS="hidden_thread" STYLE="display:none;"><DIV CLASS="thread"><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633010937127360000')" ID="Img633010937127360000" CLASS="forumimg forumimg-msg_minus forum_text_icon">Crash</A> <B>lamer2</B> <SPAN CLASS="treedate">7 Dec 2006 13:08</SPAN></DIV><DIV ID="633010937127360000" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">I'm getting a Crash on test 2. What the hell is that test? Anyone knows?<BR>Plz help me...<BR>I could post my Java program.</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14226&reply=633010937127360000"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('633011296801578750')" ID="Img633011296801578750" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: Crash</A> <B>Alexander Sokolov [MAI]</B> <SPAN CLASS="treedate">7 Dec 2006 23:08</SPAN></DIV><DIV ID="633011296801578750" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">try to use arrays some larger than the number of elements</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14226&reply=633011296801578750"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV></DIV></DIV></DIV></DIV></TD></TR><TR CLASS="forum1"><TD CLASS="forum_tree_subject"><A HREF="javascript:Show('14085', '632984378881190175')" ID="Img14085" CLASS="forumimg forumimg-plus forum_text_icon">Bug or something i can't understand</A></TD><TD CLASS="forum_tree_author"><A HREF="/author.aspx?id=38386">Alex_SyktSU</A></TD><TD CLASS="forum_tree_problem"><A HREF="/problem.aspx?space=1&num=1510">1510<SPAN CLASS="problemname">. Order</SPAN></A></TD><TD CLASS="forum_tree_date">6 Nov 2006 19:24</TD><TD CLASS="forum_tree_count">3 </TD></TR><TR><TD ALIGN="LEFT" COLSPAN="5" STYLE="padding:0px 2px;"><DIV ID="14085" CLASS="hidden_thread" STYLE="display:none;"><DIV CLASS="thread"><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('632983758103073750')" ID="Img632983758103073750" CLASS="forumimg forumimg-msg_minus forum_text_icon">Bug or something i can't understand</A> <B>Alex_SyktSU</B> <SPAN CLASS="treedate">6 Nov 2006 02:10</SPAN></DIV><DIV ID="632983758103073750" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">Code with this:<BR> for (int i=0; i<n; i++)<BR> {<BR> int t;<BR> scanf("%li", &t);<BR> ...<BR>gives wa1<BR> <BR>Code with this:<BR> for (int i=0; i<n; i++)<BR> {<BR> int t;<BR> cin >> t;<BR> ...<BR>gives tl36.<BR> Help, please, if know what is the problem</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14085&reply=632983758103073750"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('632984184615877675')" ID="Img632984184615877675" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: Bug or something i can't understand</A> <B>Anton [SUrSU]</B> <SPAN CLASS="treedate">6 Nov 2006 14:01</SPAN></DIV><DIV ID="632984184615877675" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">Use scanf("%d", &t). There is 32bit compilers.</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14085&reply=632984184615877675"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('632984378881190175')" ID="Img632984378881190175" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: Bug or something i can't understand</A> <B>Alex_SyktSU</B> <SPAN CLASS="treedate">6 Nov 2006 19:24</SPAN></DIV><DIV ID="632984378881190175" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">Tried, result is exactly the same: wa1</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14085&reply=632984378881190175"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></TD></TR><TR CLASS="forum0"><TD CLASS="forum_tree_subject"><A HREF="javascript:Show('14083', '632983371424011250')" ID="Img14083" CLASS="forumimg forumimg-plus forum_text_icon">Time Limit...</A></TD><TD CLASS="forum_tree_author"><A HREF="/author.aspx?id=48428">Ruslan</A></TD><TD CLASS="forum_tree_problem"><A HREF="/problem.aspx?space=1&num=1510">1510<SPAN CLASS="problemname">. Order</SPAN></A></TD><TD CLASS="forum_tree_date">5 Nov 2006 15:25</TD><TD CLASS="forum_tree_count">2 </TD></TR><TR><TD ALIGN="LEFT" COLSPAN="5" STYLE="padding:0px 2px;"><DIV ID="14083" CLASS="hidden_thread" STYLE="display:none;"><DIV CLASS="thread"><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('632983348708698750')" ID="Img632983348708698750" CLASS="forumimg forumimg-msg_minus forum_text_icon">Time Limit...</A> <B>Ruslan</B> <SPAN CLASS="treedate">5 Nov 2006 14:47</SPAN></DIV><DIV ID="632983348708698750" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">I use:<BR> <BR>1)sort<BR>2)count algorithm in the loop to get the number>N/2;<BR>that loop iterates each elem. of a container...<BR> <BR>How to avoid Time Limit..?</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14083&reply=632983348708698750"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('632983371424011250')" ID="Img632983371424011250" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: Time Limit...</A> <B>Nechaev Ilya (Rybinsk SAAT)</B> <SPAN CLASS="treedate">5 Nov 2006 15:25</SPAN></DIV><DIV ID="632983371424011250" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">I have three ideas:<BR> <BR>1) Use fast sorting algorithm<BR>2) Don't use containers. I don't like it because it is too hard to debug solutions while using it, and i think containers works slower.<BR>3) Don't use sorting at all. Try to find O(N) algortihm.</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14083&reply=632983371424011250"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV></DIV></DIV></DIV></DIV></TD></TR><TR CLASS="forum1"><TD CLASS="forum_tree_subject"><A HREF="javascript:Show('14071', '632981919903386250')" ID="Img14071" CLASS="forumimg forumimg-plus forum_text_icon">Did anyone solve this with mergesort on C++?(+)</A></TD><TD CLASS="forum_tree_author"><A HREF="/author.aspx?id=33910">SPIRiT</A></TD><TD CLASS="forum_tree_problem"><A HREF="/problem.aspx?space=1&num=1510">1510<SPAN CLASS="problemname">. Order</SPAN></A></TD><TD CLASS="forum_tree_date">3 Nov 2006 23:06</TD><TD CLASS="forum_tree_count">2 </TD></TR><TR><TD ALIGN="LEFT" COLSPAN="5" STYLE="padding:0px 2px;"><DIV ID="14071" CLASS="hidden_thread" STYLE="display:none;"><DIV CLASS="thread"><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('632981673043386250')" ID="Img632981673043386250" CLASS="forumimg forumimg-msg_minus forum_text_icon">Did anyone solve this with mergesort on C++?(+)</A> <B>SPIRiT</B> <SPAN CLASS="treedate">3 Nov 2006 16:15</SPAN></DIV><DIV ID="632981673043386250" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">I was getting WA for this task, when I used mergesort (and in other tasks too). But when I changed to binary heap sort, I got AC...</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14071&reply=632981673043386250"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('632981919903386250')" ID="Img632981919903386250" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: Did anyone solve this with mergesort on C++?(+)</A> <B>Samsonov Alex [USU]</B> <SPAN CLASS="treedate">3 Nov 2006 23:06</SPAN></DIV><DIV ID="632981919903386250" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">It seems that something is wrong with your mergesort. Certainly. What about problem 1090?</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14071&reply=632981919903386250"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV></DIV></DIV></DIV></DIV></TD></TR><TR CLASS="forum0"><TD CLASS="forum_tree_subject"><A HREF="javascript:Show('14073', '632981772478855000')" ID="Img14073" CLASS="forumimg forumimg-plus forum_text_icon">1510</A></TD><TD CLASS="forum_tree_author"><A HREF="/author.aspx?id=48668">HusanRustam</A></TD><TD CLASS="forum_tree_problem"><A HREF="/problem.aspx?space=1&num=1510">1510<SPAN CLASS="problemname">. Order</SPAN></A></TD><TD CLASS="forum_tree_date">3 Nov 2006 19:00</TD><TD CLASS="forum_tree_count">1 </TD></TR><TR><TD ALIGN="LEFT" COLSPAN="5" STYLE="padding:0px 2px;"><DIV ID="14073" CLASS="hidden_thread" STYLE="display:none;"><DIV CLASS="thread"><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('632981772478855000')" ID="Img632981772478855000" CLASS="forumimg forumimg-msg_minus forum_text_icon">1510</A> <B>HusanRustam</B> <SPAN CLASS="treedate">3 Nov 2006 19:00</SPAN></DIV><DIV ID="632981772478855000" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">what is the test 19?</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14073&reply=632981772478855000"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV></DIV></DIV></DIV></TD></TR><TR CLASS="forum1"><TD CLASS="forum_tree_subject"><A HREF="javascript:Show('14067', '632981512881355000')" ID="Img14067" CLASS="forumimg forumimg-plus forum_text_icon">Wazzup is WA by Test 9</A></TD><TD CLASS="forum_tree_author"><A HREF="/author.aspx?id=46787">Alex Tyakunov</A></TD><TD CLASS="forum_tree_problem"><A HREF="/problem.aspx?space=1&num=1510">1510<SPAN CLASS="problemname">. Order</SPAN></A></TD><TD CLASS="forum_tree_date">3 Nov 2006 11:48</TD><TD CLASS="forum_tree_count">2 </TD></TR><TR><TD ALIGN="LEFT" COLSPAN="5" STYLE="padding:0px 2px;"><DIV ID="14067" CLASS="hidden_thread" STYLE="display:none;"><DIV CLASS="thread"><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('632981496997448750')" ID="Img632981496997448750" CLASS="forumimg forumimg-msg_minus forum_text_icon">Wazzup is WA by Test 9</A> <B>Alex Tyakunov</B> <SPAN CLASS="treedate">3 Nov 2006 11:21</SPAN></DIV><DIV ID="632981496997448750" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">It's my program<BR> <BR>[code deleted]<BR> <BR>what???<BR> <BR><I>Edited by moderator 29.12.2006 09:21</I></DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14067&reply=632981496997448750"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('632981512881355000')" ID="Img632981512881355000" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: Wazzup is WA by Test 9</A> <B>Anton [SUrSU]</B> <SPAN CLASS="treedate">3 Nov 2006 11:48</SPAN></DIV><DIV ID="632981512881355000" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">If you correct all your bugs ur algo will get TL</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14067&reply=632981512881355000"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV></DIV></DIV></DIV></DIV></TD></TR><TR CLASS="forum0"><TD CLASS="forum_tree_subject"><A HREF="javascript:Show('14023', '632981193394323750')" ID="Img14023" CLASS="forumimg forumimg-plus forum_text_icon">What's wrong with #6 test?</A></TD><TD CLASS="forum_tree_author"><A HREF="/author.aspx?id=46730">Intelligent_Design</A></TD><TD CLASS="forum_tree_problem"><A HREF="/problem.aspx?space=1&num=1510">1510<SPAN CLASS="problemname">. Order</SPAN></A></TD><TD CLASS="forum_tree_date">3 Nov 2006 02:55</TD><TD CLASS="forum_tree_count">4 </TD></TR><TR><TD ALIGN="LEFT" COLSPAN="5" STYLE="padding:0px 2px;"><DIV ID="14023" CLASS="hidden_thread" STYLE="display:none;"><DIV CLASS="thread"><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('632977683294191250')" ID="Img632977683294191250" CLASS="forumimg forumimg-msg_minus forum_text_icon">What's wrong with #6 test?</A> <B>Intelligent_Design</B> <SPAN CLASS="treedate">30 Oct 2006 01:25</SPAN></DIV><DIV ID="632977683294191250" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">Hey, I wrote this code, but it fails on the 6th test... What can be my error?<BR> <BR>[code deleted]<BR> <BR><I>Edited by moderator 29.12.2006 09:21</I></DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14023&reply=632977683294191250"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('632978391393097500')" ID="Img632978391393097500" CLASS="forumimg forumimg-msg_minus forum_text_icon">6th test is correct. Test your code more carefully. (-)</A> <B>Sandro (USU)</B> <SPAN CLASS="treedate">30 Oct 2006 21:05</SPAN></DIV><DIV ID="632978391393097500" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right"></DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14023&reply=632978391393097500"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('632979485042785000')" ID="Img632979485042785000" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: 6th test is correct. Test your code more carefully. (-)</A> <B>mai7</B> <SPAN CLASS="treedate">1 Nov 2006 03:28</SPAN></DIV><DIV ID="632979485042785000" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">I don't know how I did it, I had same code and same was the trouble (WA 6)! I'd also taken into consideration the condition that more than half of numbers are equal.<BR> <BR>[code deleted]<BR> <BR><I>Edited by moderator 29.12.2006 09:21</I></DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14023&reply=632979485042785000"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('632981193394323750')" ID="Img632981193394323750" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: 6th test is correct. Test your code more carefully. (-)</A> <B>Ilia S. Chm (Spb SU)</B> <SPAN CLASS="treedate">3 Nov 2006 02:55</SPAN></DIV><DIV ID="632981193394323750" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">AC solution: use qsort(A) and then output A[n/2]</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14023&reply=632981193394323750"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></DIV></TD></TR><TR CLASS="forum1"><TD CLASS="forum_tree_subject"><A HREF="javascript:Show('14014', '632977354636691250')" ID="Img14014" CLASS="forumimg forumimg-plus forum_text_icon">Why my program has WA on 1 test?</A></TD><TD CLASS="forum_tree_author"><A HREF="/author.aspx?id=42262">Liceum#64_Yurik</A></TD><TD CLASS="forum_tree_problem"><A HREF="/problem.aspx?space=1&num=1510">1510<SPAN CLASS="problemname">. Order</SPAN></A></TD><TD CLASS="forum_tree_date">29 Oct 2006 16:17</TD><TD CLASS="forum_tree_count">2 </TD></TR><TR><TD ALIGN="LEFT" COLSPAN="5" STYLE="padding:0px 2px;"><DIV ID="14014" CLASS="hidden_thread" STYLE="display:none;"><DIV CLASS="thread"><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('632977292171847500')" ID="Img632977292171847500" CLASS="forumimg forumimg-msg_minus forum_text_icon">Why my program has WA on 1 test?</A> <B>Liceum#64_Yurik</B> <SPAN CLASS="treedate">29 Oct 2006 14:33</SPAN></DIV><DIV ID="632977292171847500" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">my program has Wa on 1 test...<BR> <BR>[code deleted]<BR> <BR><I>Edited by moderator 29.12.2006 09:22</I></DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14014&reply=632977292171847500"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('632977354636691250')" ID="Img632977354636691250" CLASS="forumimg forumimg-msg_minus forum_text_icon">Hints</A> <B>linuson</B> <SPAN CLASS="treedate">29 Oct 2006 16:17</SPAN></DIV><DIV ID="632977354636691250" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">if the answer is a0.<BR>delete a0 and a1 (a0!=a1)<BR>the answer is still a0<BR> <BR><I>Edited by author 29.10.2006 16:21</I></DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14014&reply=632977354636691250"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV></DIV></DIV></DIV></DIV></TD></TR><TR CLASS="forum0"><TD CLASS="forum_tree_subject"><A HREF="javascript:Show('14010', '632977299603253750')" ID="Img14010" CLASS="forumimg forumimg-plus forum_text_icon"> red, green, and blue banknotes.</A></TD><TD CLASS="forum_tree_author"><A HREF="/author.aspx?id=48071">deepesh</A></TD><TD CLASS="forum_tree_problem"><A HREF="/problem.aspx?space=1&num=1510">1510<SPAN CLASS="problemname">. Order</SPAN></A></TD><TD CLASS="forum_tree_date">29 Oct 2006 14:46</TD><TD CLASS="forum_tree_count">2 </TD></TR><TR><TD ALIGN="LEFT" COLSPAN="5" STYLE="padding:0px 2px;"><DIV ID="14010" CLASS="hidden_thread" STYLE="display:none;"><DIV CLASS="thread"><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('632977226691378750')" ID="Img632977226691378750" CLASS="forumimg forumimg-msg_minus forum_text_icon">red, green, and blue banknotes.</A> <B>deepesh</B> <SPAN CLASS="treedate">29 Oct 2006 12:44</SPAN></DIV><DIV ID="632977226691378750" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right"> <BR>Is only a maximum of 3 different varieties of bank notes possible?</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14010&reply=632977226691378750"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV><DIV CLASS="forum_shift_right"><DIV CLASS="board"><A HREF="javascript:Show('632977299603253750')" ID="Img632977299603253750" CLASS="forumimg forumimg-msg_minus forum_text_icon">Re: red, green, and blue banknotes.</A> <B>Nechaev Ilya (Rybinsk SAAT)</B> <SPAN CLASS="treedate">29 Oct 2006 14:46</SPAN></DIV><DIV ID="632977299603253750" CLASS="hidden_message"><DIV CLASS="message forum_message_box forum_shift_right">I supposed that there are can be more than 3 banknote types and get AC. I think in both cases it is so easy.</DIV><DIV CLASS="forum_shift_right"><A HREF="post.aspx?id=14010&reply=632977299603253750"><DIV CLASS="forumimg forumimg-button forumimg-reply_eng"></DIV></A><DIV CLASS="forumimg-afterbutton"></DIV></DIV></DIV></DIV></DIV></DIV></DIV></TD></TR></TABLE><DIV CLASS="afterpages board"><A HREF="?space=1&num=1510&from=632977272753878750">Previous Page</A></DIV><BR><TABLE WIDTH="100%" CELLSPACING="0" CELLPADDING="0" BORDER="0" CLASS="board"><TR><TD ALIGN="LEFT"><A HREF="post.aspx?space=1&num=1510"><DIV CLASS="forumimg forumimg-button forumimg-post_eng"></DIV></A></TD><TD ALIGN="RIGHT">Style: <A HREF="?space=1&num=1510&style=plain" REL="nofollow">flat</A> | <A HREF="?space=1&num=1510&style=tree" REL="nofollow">tree</A> | <A HREF="?space=1&num=1510&style=classic" REL="nofollow">nested</A><BR>Thread Order: <A HREF="?space=1&num=1510&order=last" REL="nofollow">bubble</A> | <A HREF="?space=1&num=1510&order=first" REL="nofollow">fixed</A><BR></TD></TR></TABLE></FORM></DIV></TD></TR></TABLE></TD></TR><TR><TD CLASS="footer"><script type="text/javascript">(function (d, w, c) { (w[c] = w[c] || []).push(function() { try { w.yaCounter20918869 = new Ya.Metrika({id:20918869, webvisor:true, clickmap:true, trackLinks:true, accurateTrackBounce:true}); } catch(e) { } }); var n = d.getElementsByTagName("script")[0], s = d.createElement("script"), f = function () { n.parentNode.insertBefore(s, n); }; s.type = "text/javascript"; s.async = true; s.src = (d.location.protocol == "https:" ? "https:" : "http:") + "//mc.yandex.ru/metrika/watch.js"; if (w.opera == "[object Opera]") { d.addEventListener("DOMContentLoaded", f, false); } else { f(); } })(document, window, "yandex_metrika_callbacks");</script><noscript><div><img src="//mc.yandex.ru/watch/20918869" style="position:absolute; left:-9999px;" alt=""></div></noscript>© 2000-2014 <A HREF="/team.aspx">Timus Online Judge Team</A>. All rights reserved.</TD></TR></TABLE></BODY></HTML>