| Show all threads Hide all threads Show all messages Hide all messages |
| WA #3 | Marat | 1756. One and a Half Diggers | 19 Apr 2012 00:21 | 6 |
WA #3 Marat 21 Jul 2011 17:35 Give me some tests, please. I think the reason for WA3 is in the following test 5 6 4 The evaluator accepts 8 8 7 7 but not 8 8 8 6. But why is 8 8 8 6 wrong. The max is still only 8. My program outputs 8 8 8 6 and got AC I had the same error. The mistake was in logic. In test 3 3 6 I had 2 2 2 2 1 1 but correct answer is 2 2 2 2 1 0 ,of course. I think you are right. but my program which WA#3 output 1 2 1 2 1 2 in test 3 3 6,I think it's right,too.... |
| In the same order? | Newbies | 1791. Uncle Styopa and Buses | 19 Apr 2012 00:15 | 2 |
"The buses running in one direction should pass the section under repair in the same order they approach it." Does it means that answer to: 2 1 2 1 1 1 2 2 will be NO? |
| Help please!!! I'dont understant problem!!! | Enigma [UB of TUIT] | 1821. Biathlon | 18 Apr 2012 19:24 | 5 |
Why input 6 Zaitseva 21:38.2 Hauswald 21:21.0 Boulygina 22:04.4 Henkel 22:06.1 Wilhelm 21:11.1 Jonsson 22:05.8 Answer: 3 Hauswald Wilhelm Zaitseva???????/ I found the explanation a bit below: for a contestant to be in the answer, their time must be better than all the previous ones. Complication: more than 1 contestant can be on the track at the same time. I only just realized this. It is very frustrating to not understand the problem requirements, and to code something which turns out to be incorrect. Edited by author 14.12.2011 17:20 Please elaborate more, xerxe. I speak perfect English and yet I don't understand the wording of the problem!! Edited by author 14.12.2011 22:07 The problem states that contestants start each 30 seconds. Let's say that running times are: - Runner1 30:00.0 (starting at 0:00.0, finishing at 30:00.0) - Runner2 29:31.0 (starting at 0:30.0, finishing at 30:01.0) This means that - Runner1 has the best time after 30 minutes from the start of the race - Runner2 has the best time, 1 second after Runner1 So they are both in the top. However, if: - Runner1 30:00.0 (starting at 0:00.0, finishing at 30:00.0) - Runner2 29:29.0 (starting at 0:30.0, finishing at 29:59.0) Then Runner2 finishes BEFORE Runner1, so Runner1 will never have a best time. An explanation for the problem sample is a bit below ( http://acm.timus.ru/forum/thread.aspx?id=26847&upd=634557023855807397). For me, it was easier to explain on this other example. Hope this is clear, good luck! P.S.: I see you already have AC, congratulations! Edited by author 16.12.2011 19:35thank you xerxe for clearly explaination |
| How to solve this task? n*n*k=4e+9 - too long... (-) | Dart MirzMan C++ Edition (Mirzoyan Alexey, Rybinsk SAAT) | 1523. K-inversions | 18 Apr 2012 05:49 | 8 |
my N*K*Log(N) hint: problem with stars(1028) P.S. i solve it with 38 attempts. Thanks!!! P.S. I solved the "I" task with 15 attempts:) Edited by author 18.02.2007 17:10 Damn! ];-/ Realy, this problem is almost identical to (1028)Stars. Why didn't I recognize it? Maybe growing old :) Thanks for hint! How to solve this problem when K is quite big? Red_Black trees. Dynamic statistics with renewing after adding each -a[i] going backward from the end. We store int d[10] for each node balanced tree and for each subtree T(x). Here d[i]- number of sequences beggining from x with length i. An array of BIT's works well here. RSQ works as well and the solution is really quick and simple.O(k*n*log(n)) gives 0.046s(That's with vectors, probably without them it would be even faster). Edited by author 18.04.2012 08:47 |
| Easy Answer (Russian) | Ankerok | 1213. Cockroaches! | 17 Apr 2012 20:36 | 1 |
|
| What's the fourth case | Huang SX | 1189. Pairs of Integers | 17 Apr 2012 19:23 | 2 |
i don't know where could be wrong |
| who can give me some wa data??although I know my solution is wa. | ben3ben | 1099. Work Scheduling | 17 Apr 2012 17:00 | 2 |
#include <cstdio> #include <string.h> using namespace std; struct dat_edge { int last,aim; }edge[500000]; int temp[300],len_edge,pl[300],next[300],n,m; void edge_insert(int x,int y) { len_edge++; edge[len_edge].aim=y; edge[len_edge].last=pl[x]; pl[x]=len_edge; } bool dfs(int root,int ps) { if (temp[root]==ps) return false; if (ps==-1) return true; temp[root]=ps; int p=pl[root]; bool t; while (p!=-1) { int tmp=edge[p].aim; if (temp[tmp]==ps) { p=edge[p].last;continue; } if (next[tmp]==-1) t=dfs(tmp,-1); else t=dfs(next[tmp],ps); if (t) { next[root]=edge[p].aim; next[edge[p].aim]=root; return true; } p=edge[p].last; } return false; } int main() { //freopen("1099.in","r",stdin); //freopen("1099.out","w",stdout); int i,j,k,ans,coun,x,y; bool ok; scanf("%d",&n); len_edge=-1; for (i = 0;i<=n;i++) pl[i]=-1; while (scanf("%d%d",&x,&y)!=EOF) { edge_insert(x,y); edge_insert(y,x); } coun=0; for (i = 0;i<=n;i++) next[i]=-1; memset(temp,0,sizeof(temp)); ans=0; for (i = 1;i<=n;i++) { ok=false; if (next[i]==-1) ok=dfs(i,++coun); if (ok) ans++; } printf("%d\n",ans*2); for (i = 1;i<=n;i++) if (next[i]>i) { printf("%d %d\n",i,next[i]); } } 15 1 7 10 9 7 1 5 2 1 6 13 8 13 15 2 3 3 6 10 14 5 5 11 15 1 3 13 5 15 3 13 2 ans:12 |
| WA#4 | esqo | 1104. Don’t Ask Woman about Her Age | 17 Apr 2012 00:59 | 1 |
WA#4 esqo 17 Apr 2012 00:59 |
| i and j can be eqal | Spatarel Dan Constantin | 1526. Martian Plates | 16 Apr 2012 18:40 | 1 |
i and j can be eqal! This made my get a WA#6. Here are some interesting tests: Input: 1000 4 2 1 1 1 Output: 7 Input: 1000 4 1 1 1 1 Output: 1 |
| If you have WA #7 | Smilodon_am [Obninsk INPE] | 1440. Training Schedule | 16 Apr 2012 11:51 | 1 |
Try this test: Sunday December 24 17 17 Answer: 1 Monday |
| Why TL with n*log(m) solution? | Vitalii Arbuzov | 1126. Magnetic Storms | 16 Apr 2012 00:26 | 3 |
Here is my solution. It uses heap(PriorityQueue) and queue(LinkedList). It TLs on 2nd test case. Is there any solution which is asymptotically better than this? What are points to improve? public class P1126 { public static void main(String[] args) throws IOException { StreamTokenizer in = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in))); in.nextToken(); int m = (int)in.nval; PriorityQueue<Integer> heap = new PriorityQueue<Integer>(m, new Comparator<Integer>() { public int compare(Integer i, Integer j) { return j.compareTo(i); } }); LinkedList<Integer> queue = new LinkedList<Integer>(); int cur; while (true) { in.nextToken(); cur = (int)in.nval; if (cur == -1) break; heap.add(cur); queue.add(cur); if (heap.size() == m) { System.out.println(heap.peek()); heap.remove(queue.pollFirst()); } } } } Your solution's complexity is O(NM), because heap.remove(Object) requires linear time, not O(logN) time. Just submit a brute-force. The easiest improvement is SQRT decomposition, but it's not needed in this case. |
| How to make program fast ? | Varun Sharma | 1102. Strange Dialog | 15 Apr 2012 23:10 | 2 |
Hi, I implemented it using DFA and it is taking around 0.8 seconds. However I can see that some people have done it in 0.03 seconds (that's 27 times faster)? How can it made faster ? Thanks Varun Edited by author 08.03.2010 06:17 Hello, Could you please give me same states of the DFA machine? Thanks in advance |
| Please!!! Someone give me some tests. WA2 :(( | Hedin | 1345. HTML | 15 Apr 2012 23:10 | 2 |
try this test a:array[1..5] of integer; my AC program out: a:<span class=keyword>array</span>[<span class=number>1</span>..<span class=numb er>5</span>] <span class=keyword>of</span> integer; |
| crash!! please help!! | Dmitriy Black | 1537. Ents | 15 Apr 2012 18:06 | 3 |
my program works fine on my computer. it even gives right answers :) But when i submit it has crash on 20 test. I cannot understant why. Please help!! import java.io.*; import java.util.Arrays; public class Task_1537 { public static void main(String[] args) throws Exception{ StreamTokenizer st = new StreamTokenizer(new InputStreamReader(System.in)); st.nextToken(); int k = (int) st.nval; st.nextToken(); int p = (int) st.nval;
int t[] = new int[k+1]; t[2] = 1 % p; for (int i = 3; i <= k; i++){ if ((i & 1) == 1) t[i] = t[i-1]; else t[i] = t[i-1] + t[i/2]; if (t[i] >= p) t[i] = t[i] - p; } //System.out.println(Arrays.toString(t)); System.out.println(t[k]); } } // JAVA : import java.io.*; import java.util.Arrays; public class Task_1537 { public static void main(String[] args) throws Exception{ StreamTokenizer st = new StreamTokenizer(new InputStreamReader(System.in)); st.nextToken(); int k = (int) st.nval; st.nextToken(); int p = (int) st.nval; if(k<2)System.out.println(0); else { int t[] = new int[k+1]; t[2] = 1 % p; for (int i = 3; i <= k; i++){ if ((i & 1) == 1) t[i] = t[i-1]; else t[i] = t[i-1] + t[i/2]; if (t[i] >= p) t[i] = t[i] - p; } //System.out.println(Arrays.toString(t)); System.out.println(t[k]); } } } // C++ : #include<stdio.h> int main(){ int k,p,i; int *t; scanf("%i%i",&k,&p); if(k<2)printf("0"); else { t = new int[k+3]; t[2] = 1 % p; for (i = 3; i <= k; i++){ if ((i & 1) == 1) t[i] = t[i-1]; else t[i] = t[i-1] + t[i/2]; if (t[i] >= p) t[i] = t[i] - p; } printf("%i",t[k]); } } CONST MaxN = 10000000; VAR K, P : Longint; A : Array [0 .. MaxN] of Longint; PROCEDURE Solve; Var i : Longint; Begin A[1] := 0; A[2] := 1 mod P; for i := 3 to K do if i mod 2 = 0 then A[i] := (A[i - 1] + A[i div 2]) mod P else A[i] := A[i - 1] mod P; End; PROCEDURE Run; Begin Read(K, P); if K<2 then WriteLn(0) else begin Solve; WriteLn(A[K]); end; End; BEGIN Run; END. |
| very easy q. however i got wa, does anybody now test 32??? | Shabdanbek | 1877. Bicycle Codes | 14 Apr 2012 23:38 | 1 |
|
| Hint | hoan | 1042. Central Heating | 13 Apr 2012 15:20 | 3 |
Hint hoan 14 Dec 2010 23:48 there is only one answer or no answer, therefor if the solution exist it's the shortest. hope can help you. GOOD LUCK!!! Re: Hint Tony Beta Lambda 18 Feb 2012 10:58 No, consider the following case: 3 1 -1 1 -1 1 2 3 -1 both 3 and 1 2 3 are correct answer but 3 is the shortest. Read the description carefully! Your case is wrong because technician 1 and 2 can replace each other! As the condition indicates that these vectors are linear independent, it's likely that there be zero or one solution. |
| No subject | TESTER | 1612. Tram Forum | 12 Apr 2012 22:04 | 2 |
anyone knows test 6, I have been with this problem for 1 hour test 6 should take account ",.?!-: " |
| accepted c | Sunnat | 1370. Magician | 12 Apr 2012 17:54 | 1 |
#include<stdio.h> main() { int N,M,a[1000],i; scanf("%i %i",&N,&M); for(i=0;i<N;i++)scanf("%i",&a[i]); for(i=M;i<M+10;i++)printf("%i",a[i%N]); } |
| ambiguous problem | waterlaz | 1177. Like Comparisons | 12 Apr 2012 16:35 | 1 |
there is a lot of stuff one has to guess in order to get this problem accepted. Anyway, watch out for this test: 'a' like '[a-]' |
| What is in test №2? | IgorKoval(from Pskov) | 1875. Angry Birds | 12 Apr 2012 09:43 | 10 |
""""It is guaranteed that there is no straight line containing the slingshot and more than one monkey."""" This test is not correct. =) You are right, sorry. Try also 1 1 2 4 3 9 4 16 5 25 Try my test: 1 1 1 2 1 3 1 4 1 5 ans: 5 Test #2 1 5 2 8 3 10 4 8 5 5 ans : 2 1 1 2 4 3 9 4 8 5 5 ans : 3 !!!!!! =) when we draw parabola y = a*x*x+b*x, be careful, this must be: a<0 and b!=0 P.S.: hint: fabs( p[i].y - a*p[i].x*p[i].x - b*p[i].x ) <= 1e-10( don't use p[i].y = a*p[i].x*p[i].x + b*p[i].x ) My solution got AC only on fabs()<=1e-8 fabs()<=1e-9 had WA#26 (!) fabs()<=1e-7 had WA#57 (!!!) I'm Angry very much. To avoid be angry! How verify that big number D==0? You may use next idea: int p[6]={61,67,59,53,41,47}; for(i=1;i<=6;i++) if(D%p[i-1]>0) break; if (i>6) return true; More rightly: We can solve problem 6 times in fields Z(61),...,Z(47) All numbers will be not greater 100, but if in all fields D==0 then in N also D==0. P.S. I appled this idea. I had problems with logics but no problems with precision and 5 -is oldest WA test for me. Edited by author 25.10.2011 13:05 I pass all the tests in the topic and have set the precision but still get WA#14. Last test is not correct, because of point (1,1) and (5,5) belong same line. You are right, sorry. Try also 1 1 2 4 3 9 4 16 5 25 ans: 5 =) Thank you!!! Edited by author 22.10.2011 23:32 |