Common Board| Show all threads Hide all threads Show all messages Hide all messages | | If you have CRASH... | Burmistrov Ivan (USU) | 1329. Galactic History | 2 Sep 2010 15:35 | 2 | If you have CRASH, may be, will help for you to make columns of a global variable and to clean from definitions of procedures. I got AC... Maybe you should increase the stack size as well. | | Tips | MAK | 1329. Galactic History | 2 Sep 2010 15:33 | 1 | Tips MAK 2 Sep 2010 15:33 If you get WA2 try this one: Input: 3 3 2 2 1 1 -1 3 1 2 3 2 1 3 Output: 1 2 1 Also if you get WA12 pay attention for: "All identifiers lie between 0 and 40000." | | why is the sollution code for 1001 wrong | Yeqianqian | 1001. Reverse Root | 2 Sep 2010 14:09 | 1 | #include <iostream> #include <iomanip> #include<math.h> #include<vector> using namespace std; int main() { cout<<setiosflags(ios::fixed)<<setprecision(4); vector<double>v; double a; for(int i=0;!cin.eof();i++ ) { cin>>a; v.push_back(sqrt(a)); } for(int j=v.size()-2;j>=0;j--) {cout<<v[j]<<"\n";} return 0; } | | No subject | time-lizk | 1489. Points on a Parallelepiped | 2 Sep 2010 12:29 | 2 | How to control the output precision?What does "to the acuracy of 10-6? Up! Why in task 10^6, but output 10^16 | | why wa2?I have tried many tests,and output the right answer,but WA2 | uuu | 1215. Exactness of Projectile Hit | 1 Sep 2010 20:20 | 1 | var i,j,k,n,m,tot:longint; ans,x1,y1,x2,y2,d1,d2,d3,x,y,angle1,angle2,t,p1,p2:double; function min(xx,yy:double):double; begin if xx>yy then exit(yy); exit(xx); end; begin {assign(input,'1215.in');reset(input);} read(x,y,n); read(x1,y1); p1:=x1; p2:=y1; d1:=sqrt(sqr(x-x1)+sqr(y-y1)); ans:=999999999; tot:=0; for i:=2 to n do begin read(x2,y2); if (x1<x)and(x2>=x)and((y1<y)or(y2<y)) then inc(tot); d2:=sqrt(sqr(x-x2)+sqr(y-y2)); d3:=sqrt(sqr(x1-x2)+sqr(y1-y2)); angle1:=(d2*d2+d3*d3-d1*d1)/(2*d2*d3); angle2:=(d1*d1+d3*d3-d2*d2)/(2*d1*d3); if (angle1>=0)and(angle2>=0) then begin if x1=x2 then t:=abs(x1-x) else t:=((y1-y2)/(x1-x2)*x-y+y1+(y2-y1)/(x1-x2)*x1)/(sqrt(sqr((y1-y2)/(x1-x2))+1)); t:=abs(t); ans:=min(ans,t); end else begin t:=min(d1,d2); ans:=min(ans,t); end; d1:=d2; x1:=x2; y1:=y2; end; x2:=p1; y2:=p2; if (x1<x)and(x2>=x)and((y1<y)or(y2<y)) then inc(tot); d2:=sqrt(sqr(x-x2)+sqr(y-y2)); d3:=sqrt(sqr(x1-x2)+sqr(y1-y2)); angle1:=(d2*d2+d3*d3-d1*d1)/(2*d2*d3); angle2:=(d1*d1+d3*d3-d2*d2)/(2*d1*d3); if (angle1>=0)and(angle2>=0) then begin if x1=x2 then t:=abs(x1-x) else t:=((y1-y2)/(x1-x2)*x-y+y1+(y2-y1)/(x1-x2)*x1)/(sqrt(sqr((y1-y2)/(x1-x2))+1)); t:=abs(t); ans:=min(ans,t); end else begin t:=min(d1,d2); ans:=min(ans,t); end; if odd(tot) then ans:=0; writeln(ans*2:0:3); end. | | tests | Tural Neymanov | 1579. Coat Transportation | 1 Sep 2010 11:56 | 2 | tests Tural Neymanov 13 Mar 2010 02:02 just check your program on these tests ---------- 4 3 1 5 8 10 answer: 1 8 5 10 wrong answer: 1 5 8 10 ---------- 4 2 3 5 7 10 answer: 5 10 3 7 wrong answer: 7 10 5 3 That's helped me with wa#9: 9 0 1 1 6 6 23 35 36 38 40 Right answer has 2 trips. | | Tricky (?) and valid (?) test | Maxim Delyukin aka dAFTc0d3r [Yaroslavl SU] | 1563. Bayan | 1 Sep 2010 01:06 | 3 | I know AC solution that answers 5 on this test instead of 3: /////////////start of test 6
////////////end of test 6 [1 space] [1 space] [2 spaces] [2 spaces] [3 spaces] [3 spaces] [EOF] Also this test should be answered 0 instead of 1. 2 MEXX MEXX I gues this tests suit the condition "The brands are the strings of Latin letters and blanks." and may be added. Thank you. You can Quote my post to view or copy&paste this tests. Blanks are abandoned by forum, but are in the post. No subject dAFTc0d3r [Yaroslavl SU] 1 Sep 2010 01:06 | | My prog deals with coefficients, but WA on test #16. Can anybody help me or gimme that test? | Maigo Akisame (maigoakisame@yahoo.com.cn) | 1133. Fibonacci Sequence | 31 Aug 2010 21:06 | 7 | It works like this: f1=1*f1+0*f2; f2=0*f1+1*f2; f3=1*f1+1*f2; f4=1*f1+2*f2; f5=2*f1+3*f2; f6=3*f1+5*f2; ...^....^ ...|....These coefficients are in the array c2 ...These coefficients are in the array c1 ----PROG BELOW---- program ural1133; const maxn=2001; var c1,c2:array[1..maxn]of extended; x,y,n,i:integer; fx,fy,f1,f2:longint; function min(a,b:integer):integer; begin if a<b then min:=a else min:=b; end; function max(a,b:integer):integer; begin if a>b then max:=a else max:=b; end; begin readln(x,fx,y,fy,n); i:=min(min(x,y),n); if i<=0 then begin i:=1-i; inc(x,i);inc(y,i);inc(n,i); end; c1[1]:=1;c2[1]:=0; c1[2]:=0;c2[2]:=1; for i:=3 to max(max(x,y),n) do begin c1[i]:=c1[i-2]+c1[i-1]; c2[i]:=c2[i-2]+c2[i-1]; end; f1:=round((fx*c2[y]-fy*c2[x])/(c1[x]*c2[y]-c1[y]*c2[x])); f2:=round((fx*c1[y]-fy*c1[x])/(c2[x]*c1[y]-c2[y]*c1[x])); writeln(round(c1[n]*f1+c2[n]*f2)); end. Try this: 46 1836311903 -46 -1836311903 45 Correct answer is 1134903170, but your program outputs 1073741824. No subject partisan (Andrey Korotkov) 10 Nov 2007 16:22 Edited by author 10.11.2007 16:27 I have the same problem. Can anybody help? >> writeln(round(c1[n]*f1+c2[n]*f2)); For example c1[n]*f1 may exceed extended (c1[n]*f1+c2[n]*f2 don't, but you will lost correctness), and as I understand, test from UNKNOWN LAMER (thanks!), makes it true Edited by author 10.11.2007 16:33 | | It is correct? | Vit Demidenko | 1133. Fibonacci Sequence | 31 Aug 2010 20:40 | 3 | Test 1 -2000000000 2 2000000000 3 is correct? Answer: 0 thanks i found my mistake | | Does anybody have test#3 - WA!!! | Valentine | 1265. Mirror | 31 Aug 2010 19:55 | 4 | 2 -2 0 4 0 0 2 2 ans = INVISIBLE It is not test 3. I get WA3 whith ans INVISIBLE 0 -1 2 -1 2 0 0 0 answer: visible | | WA12. Give me hint, plz. | Programmer | 1185. Wall | 31 Aug 2010 18:20 | 4 | I don`t know what bug is in my programm. Who can give me this test. Re: Help me. Vedernikoff Sergey (HSE: EconomicsForever!) 11 Feb 2009 02:31 As I remember, in 12th test the point is in precision. If you write in Pascal, use Extended (in C++ - double), use very accurate value for PI (3.1415926 is NOT enough), in Pascal use standard constant "pi", in C - 2.0*acos(0.0) Well, in my case the reason for WA#12 was inproper implementation of Graham's algorithm, not a precision. Be careful with cases, when there are points with the same polar angle. | | Is there any difference between long long and __int64? | Mato_No1 | 1017. Staircases | 31 Aug 2010 01:32 | 3 | My first code: #include <stdio.h> int n; long long f[501][501], g[501][501], res; void xxx(void) { for (int i=0; i<=n; i++) f[0][i] = 1; for (int i=1; i<35 && i<=n; i++) { for (int j=0; j<=n; j++) for (int k=0; k<=n; k++) { g[j][k] = f[j][k]; f[j][k] = 0; } for (int j=1; j<=n; j++) { for (int k=1; k<=j; k++) f[j][k] = f[j][k - 1] + g[j - k][k - 1]; for (int k=j+1; k<=n; k++) f[j][k] = f[j][j]; } res += f[n][n]; } } int main(void) { scanf("%d", &n); xxx(); printf("%lld\n", --res); return 0; } WA for #6. My second code: #include <stdio.h> int n; __int64 f[501][501], g[501][501], res; void xxx(void) { for (int i=0; i<=n; i++) f[0][i] = 1; for (int i=1; i<35 && i<=n; i++) { for (int j=0; j<=n; j++) for (int k=0; k<=n; k++) { g[j][k] = f[j][k]; f[j][k] = 0; } for (int j=1; j<=n; j++) { for (int k=1; k<=j; k++) f[j][k] = f[j][k - 1] + g[j - k][k - 1]; for (int k=j+1; k<=n; k++) f[j][k] = f[j][j]; } res += f[n][n]; } } int main(void) { scanf("%d", &n); xxx(); printf("%I64d\n", --res); return 0; } AC. Edited by author 30.08.2010 08:37 Difference only here: printf("%lld\n", --res); printf("%I64d\n", --res); #include <stdio.h> int n; long long f[501][501], g[501][501], res; void xxx(void) { for (int i=0; i<=n; i++) f[0][i] = 1; for (int i=1; i<35 && i<=n; i++) { for (int j=0; j<=n; j++) for (int k=0; k<=n; k++) { g[j][k] = f[j][k]; f[j][k] = 0; } for (int j=1; j<=n; j++) { for (int k=1; k<=j; k++) f[j][k] = f[j][k - 1] + g[j - k][k - 1]; for (int k=j+1; k<=n; k++) f[j][k] = f[j][j]; } res += f[n][n]; } } int main(void) { scanf("%d", &n); xxx(); printf("%I64d\n", --res); return 0; } This is AC. | | For WA9 | Alexander Georgiev | 1439. Battle with You-Know-Who | 30 Aug 2010 16:32 | 1 | For WA9 Alexander Georgiev 30 Aug 2010 16:32 20 7 D 9 D 7 D 6 D 1 D 2 D 3 L 2 The answer should be 4. | | What is linear size of triangle (or circle , or square )? | Helpman | 1572. Yekaterinozavodsk Great Well | 30 Aug 2010 13:39 | 1 | | | Who can give me some tests,I got WA all the time!!Help!! | Ural_Yin Tong | 1200. Horns and Hoofs | 30 Aug 2010 12:46 | 8 | > try these 11 13 12 : answer 72.00 5 6 11.01 13 12: answer 72.06 6 6 0 1 1000: answer 0.00 0 0 11 13 12: my answer is 72.00 6 6 why? I had the same problem too... I think 72,00 5 6 Edited by author 30.08.2010 13:02 thank you, your first test is really good. it helped me to solve problem successfuly)) the first test is really great! thank you :) | | Unexpected helphull problem | svr | 1716. Alternative Solution | 30 Aug 2010 12:34 | 6 | During 3 days I couldn’t find appropriate way to work with big binomials having lost of order or overflow. Simple and clever routine was found and gave satisfaction. Could you give any hint: what kind of "simple routine" have you found? I also have got overflow / lost of order? Is it possible to avoid such problem in O(N^2) solution? I don't know what your algo is, but my dynamic O(N^2) solution hasn't problems with overflows - all numbers is of order N Thanks! I've got AC with O(N^2) DP. Every value was not exceeding N. But it's still interesting - how did some people get AC with 0.015sec and minimum of memory. | | int - AC, but long long - WA 2, Why? | Maria Pukhlyakova [Tomsk PU] | 1110. Power | 29 Aug 2010 21:41 | 1 | You can see two program with one difference - type. What wrong with first program? define _CRT_SECURE_NO_DEPRECATE #define _USE_MATH_DEFINES #include <utility> #include <iostream> #include <cstdio> #include <cmath> #include <algorithm> #include <cstdlib> #include <string> #include <cstring> #include <queue> using namespace std; long long n, m, y, x; bool yes = 0; int main() { //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); scanf("%lld%lld%lld",&n,&m,&y); for (int i = 0; i < m; ++i) { x = i; if (n == 0) x = 1; for (int j = 2; j <= n; ++j) x = (x*i)%m; if (x%m == y) { yes = 1; printf("%lld", i); printf(" "); } } if (!yes) printf("-1"); return 0; } #define _CRT_SECURE_NO_DEPRECATE #define _USE_MATH_DEFINES #include <utility> #include <iostream> #include <cstdio> #include <cmath> #include <algorithm> #include <cstdlib> #include <string> #include <cstring> #include <queue> using namespace std; int n, m, y, x; bool yes = 0; int main() { //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); scanf("%d%d%d",&n,&m,&y); for (int i = 0; i < m; ++i) { x = i; if (n == 0) x = 1; for (int j = 2; j <= n; ++j) x = (x*i)%m; if (x%m == y) { yes = 1; printf("%d", i); printf(" "); } } if (!yes) printf("-1"); return 0; } | | WA#33 | Bobur | 1406. Next Number | 29 Aug 2010 17:16 | 1 | WA#33 Bobur 29 Aug 2010 17:16 | | WA#6 using KMP. Can anyone help me? | williamljb | 1423. String Tale | 29 Aug 2010 16:40 | 3 | program p1423; var p:array[0..250000]of longint; a,b:array[0..250000]of char; i,j,k,n,m:longint; begin readln(n); for i:=1 to n do read(b[i]); readln; for i:=1 to n do read(a[i]); readln; p[1]:=0; j:=0; for i:=2 to n do begin while(j>0)and(b[j+1]<>b[i])do j:=p[j]; if b[j+1]=b[i] then j:=j+1; p[i]:=j; end; j:=0; for i:=1 to n do begin while(j>0)and(b[j+1]<>a[i])do j:=p[j]; if b[j+1]=a[i] then j:=j+1; end; if j=n then begin writeln(0); halt; end; if j<>0 then writeln(n-j) else writeln(-1); end. Thanks for helping! Sorry for my English... read string S, read string T, S := S + S, prefix, kmp and AC :) | | Hint | Paul | 1307. Archiver | 29 Aug 2010 13:21 | 1 | Hint Paul 29 Aug 2010 13:21 Если на паскале в конце выводимой программы поставить "readln;", получите WA1 |
|
|