Common Board What's the test 15?Can somebody tell me? Thank you. Here is my code with O(N) soulution which is get WA on #15 program coats; const maxn=200100; var g,next,t:array [0..maxn] of int64; l,a:array [0..maxn] of int64; i,k,m,n:longint; r:int64; procedure init; begin read(n,r); for i:=1 to n do read(a[i]); end; procedure solve; begin m:=1;k:=1; next[n]:=g[1];g[1]:=n;l[1]:=a[n];t[1]:=1; for i:=n-1 downto 1 do begin if l[k]-a[i]>r then begin next[i]:=g[k];g[k]:=i;l[k]:=a[i];inc(t[k]); inc(k);if k>m then k:=1; continue; end; inc(m);next[i]:=g[m];g[m]:=i;l[m]:=a[i];t[m]:=1; end; writeln(m); for i:=m downto 1 do begin write(t[i]); r:=g[i]; while r<>0 do begin write(' ',r); r:=next[r]; end; writeln; end; end; begin assign(input,'coats.in');reset(input); assign(output,'coats.out');rewrite(output); init; solve; close(input);close(output); end. Please help! Nothing serious.Just a big and hidden mistake in my program. Thank you anyway. Thanks a lot! I need to analyize why my algorithm is wrong!I use forward-star to construct Graph, and Euler circuit algorithm. unfortunately, still the prompt "Wrong answers" take N=29 p=0 q=28 i=14 L=1 p=15 q=28 i=21 L=2 p=21 q=28 i=24 L=3 this is cancelled since i value is not 10 NOW the other way p=0 q=28 i=14 L=1 p=0 q=13 i=6 L=2 p=0 q=5 i=2 L=3 this is cancelled since i value is not 10 can any body explain me this?? take N=29 p=0 q=28 i=14 L=1 p=15 q=28 i=21 L=2 p=22 q=28 i=25 L=3 this is cancelled since i value is not 10 NOW the other way p=0 q=28 i=14 L=1 p=0 q=13 i=6 L=2 p=0 q=5 i=2 L=3 this is cancelled since i value is not 10 can any body explain me this?? Answer - is a POSSIBLE value of N. It means, that from this value you CAN get I for L steps. P = 0 Q = 28 I = 14 L = 1 P = 0 Q = 13 I = 6 L = 2 P = 7 Q = 13 I = 10 L = 3 #include <stdio.h> #include <math.h> #include <iostream> int det(const double a,const double b) { int i = (int)a; double x = floor(a*10000)/10000; while (i<x)i++; if (i>=1&&i<b&&i>x)return 1; else return 0; } int main() { double p,q; int c; scanf("%lf%lf",&p,&q); p = 100 / (p); q = 100 / (q); for (c=1;det(c*q ,floor(c*p+0.00001)) == 0 ;c++); printf("%.0lf\n", c*q ); return 0; } hey there can anybody show me any example of C# code for submitting? (excuesme for my bad english) if the test like this: 5 3 2 4 5 correct ans is: 2 because: stones:-------0-1-2-3-4-5 winner player:1-0-2-0-2-2 (0 for unknown position) but AC solution returns 1 the numbers of the second line are not the positions of the stones,but the numbers of stones you can take each time Edited by author 25.03.2009 13:31 have no ideas. am i reading correctly? char buf[128]; while (scanf("%s", buf)!=-1) { call = string(buf); if (call=="-1") break; ... } Edited by author 18.03.2009 03:00 Please... because TLE#1 using dp is something unreal ooh, finally i've solved it!! thanks everyone for replying) Input: 2 Ouput: 0 X X * * 1 X * 2 + + Input: 3 Output: 0 X X X * * * 1 X X * * 2 X * 3 + + + Input: 4 Output: 0 X X X X * * * * 1 X X X * * * 2 X X * * 3 X * 4 + + + + In mathematics it's right, but here I'd got WA 2. Why? >>>>Output should contain a sequence of minimal length your output could has not minimal length OK, I'd got AC. Here right examples: Input: N = 2 Output: 0 X * 1 + X * 2 + Input: N = 3 Output: 0 X * 1 + X * 2 + X * 3 + And so on. Edited by author 25.03.2009 20:20 Petrov should use F7 instead of ctrl+F7 :) In Far file manager replacement is Ctrl+F7, F7 is search. А тут еще жюри подсунуло текст отформатированный какой-то противным DOSовским текстовым редактором -> А тут ещё жюри подсунуло текст, отформатированный каким-то противным DOSовским текстовым редактором Only one change in solution int mid = (low + high) / 2; - 1.0s int mid = (low + high) >> 1; - 0.6s More than impressive! How to use information about sum of entire sequence? I've solved this problem for any sum of sequence, not only S+N. But algo is quite complicated. Is there any way to simplify algo using information about sum of sequence? probably if you subtract 1 from every element, you get simpler problem. my program is very large, but I got AC! Edited by author 06.11.2008 19:04 for WA #4 try this triangles with pairwise parallel sides: 0 0 1 1 2 0 0 0 1 -1 2 0 Also 2 0 0 0 1 1 2 0 3 -1 4 0 2 0 0 0 1 1 2 -1 3 -2 4 -1 Angle is 180 for each case, the center or rotation you should easily find after drawing the triangles. Is there anyone who can help me with test#13? Edited by author 26.03.2009 22:11 Edited by author 26.03.2009 22:11 int a = (n*m)%2; System.out.println((a!=0)?("[second]=:]"):("[:=[first]")); size of my archive is larger than text or something else? Help Please! my source: var s: ansistring; x: char; Begin while not eof do begin read(x); if x = #13 then s := s + '#'; if (x = #10) or (x = #13) then continue; s := s + x; end; x := chr(39); writeln('//CPP'); writeln('#include<iostream.h>'); writeln('int main()'); writeln('{char s[',length(s),']="', s, '";'); write('for(int i=0;i<',length(s),';i++)if(s[i]==',x,'#',x,')cout<<"\n";else cout<<s[i];return 0;}'); End. solution with stdio.h doesn't work too var s: ansistring; x: char; Begin while not eof do begin read(x); if x = #13 then s := s + '#'; if (x = #10) or (x = #13) then continue; s := s + x; end; x := chr(39); writeln('//CPP'); writeln('#include<stdio.h>'); writeln('int main()'); writeln('{char s[',length(s),']="', s, '";'); write('for(int i=0;i<',length(s),';i++)if(s[i]==',x,'#',x,')printf("\n");else printf("%s",s[i]);return 0;}'); End. size of my archive is larger than text or something else? Help Please! Yes I can't believe in it... in the first test more than 200 lines with characters #13 and #10... in my program only 130 additional symbols and more than 70 symbols I have in reserve Am I right? Edited by author 22.03.2009 22:46 Edited by author 22.03.2009 22:52 The size of your programm is the size of your output. Pay attention. Read clearly statement. I know this or I don't understand you... archive for test is //CPP #include<iostream.h> int main() {char s[!!!length of input!!!]="text from input with # instead of eofs"; for(int i=0;i<!!!length of input!!!;i++)if(s[i]=='#')cout<<"\n";else cout<<s[i];return 0;} so size of archive(output of my program) equal the size of input - count of eofs + integer from 130 to 140 it less than length of input where I'm wrong?may be statement in russian have some bugs? |
|