| Показать все ветки Спрятать все ветки Показать все сообщения Спрятать все сообщения |
| I'm getting insane!!!now wa#2, althought I've tested it whit an AC program | Tusnad Nobrovirski | 1306. Медиана последовательности | 12 янв 2013 14:19 | 5 |
here is my code. please help me :(( #include <stdio.h> #define HMAX (1<<17) int N; unsigned int H[HMAX]; void sift(int x) { int aux, up = x>>1; if (x < 1) return; if (H[x] > H[up]) { aux = H[x]; H[x] = H[up]; H[up] = aux; sift(up); } } void perc(int x, int n) { int l = x<<1, r = (x<<1)+1, max, aux; if (r > n) return; max = l; if (H[l] < H[r]) max = r; if (H[max] > H[x]) { aux = H[max]; H[max] = H[x]; H[x] = aux; perc(max, 1+N/2); } } int main() { int i, val; long double sol; unsigned int last, blast; // freopen("1306.in", "r", stdin); scanf("%d", &N); H[0] = 4294967295; for (i = 1; i <= 1+(N/2); i++) scanf("%lu", H+i); for (i = 1; i <= 1+(N/2); i++) sift(i); for (i = 2+(N/2); i <= N; i++) { scanf("%d", &val); if (val < H[1]) { H[1] = val; perc(1, 1+(N/2)); } } blast = H[1]; H[1] = 0; perc(1, (N/2)); last = H[1]; sol = last*0.5; sol += blast*0.5; if ( (N&1) == 0 ) printf("%0.1llf\n", sol); else printf("%u\n", blast); return 0;
} Try test with n=2. FE 2 10 20 The result of my Program is 15.0 How about you ?? In my opinion, test #2 contain data like this: 1 5 Correct answer is: 5.0 I had a problem with output format. We should output the answer with one decimal digit after decimal point. My wrong program had written: 5 without fractional part. |
| k1 k2 k3 range from 0.01 to 100?? | Mickkie | 1582. Букмекеры | 12 янв 2013 09:59 | 1 |
from the betting coefficient k is (m + n) / n I think k must be greater than 1. Don't you think so? |
| test 6 | Majo | 1915. Руины титанов: воссоздание былого | 11 янв 2013 21:21 | 1 |
What is test 6? Edited by author 11.01.2013 21:21 |
| Test #16 | panLevan | 1106. Две команды | 10 янв 2013 09:39 | 1 |
Can somebody give test #16? Getting TLE Thnx |
| Hint | TakeOver | 1430. Преступление и наказание | 10 янв 2013 01:07 | 1 |
Hint TakeOver 10 янв 2013 01:07 when you search x and y (A*x+B*y = N) use something like this for x:= 0 to min(n div a, trunc(sqrt(n))) do =) |
| yet another note for WA4 | Aneto | 1252. Сортировка надгробий | 9 янв 2013 02:21 | 1 |
if stones are sorted then answer is n-1 It took me a while to find out this special case :) |
| very bad problem | amirani | 1873. Летопись GOV | 8 янв 2013 11:17 | 4 |
this is very bad problem :( |
| If you get Crash (access violation) | Berendea | 1019. Перекрашивание прямой | 8 янв 2013 05:48 | 1 |
Try the following test: 50 3081 30488 b 16217 39416 w 7248 11364 w 17676 32492 w 25292 30974 w 1686 28199 w 9576 25807 w 18823 21457 w 30775 38642 w 7758 15847 b 6289 19805 b 1546 26246 w 27602 30148 w 9296 14836 w 19435 26471 w 27882 35227 w 24453 42158 w 943 1752 b 4080 12268 w 31529 41419 w 6238 22445 w 6262 13797 w 16616 31697 w 9990 12426 w 31675 46085 w 15149 32698 b 16029 18700 b 32372 50450 w 19642 25152 b 21096 30699 b 27244 35134 b 29951 43374 w 8869 9499 w 3375 28256 w 2060 14099 b 19972 37822 b 30222 33297 b 5433 9482 w 28735 54469 b 19053 31004 w 12234 27889 b 19117 19750 b 11927 17069 w 30056 32152 b 21756 25680 w 25656 44214 b 5308 18661 b 21710 26158 b 9196 32476 b 9917 11034 b I don't know what the output is. Mine was 54496 1000000000 |
| Interesting :-) | ftc | 1632. Лазеры | 8 янв 2013 02:47 | 3 |
Nice to see, but "higher" relation is not transitive ;-) It is very easy problem, but why only 54 people solved?! This problem has simple solution and very interesting, but not obvious idea... |
| How to use reals with range 10^18 in pascal? | Shohruh | 1948. Робот на прямой | 7 янв 2013 01:19 | 4 |
can anybody explain me how to use reals with big range like 10^18 or 10^19 more precisely in pascal? If you need real numbers with best affordable precision - use long double ("extended" in pascal). Edited by author 06.01.2013 23:12 I knew the solution was k=1 or trunc((1+12*b*b/(a*a)-3*c/a)). but i could not take precision. If you need real numbers with best affordable precision - use long double ("extended" in pascal). F**k, spoiler =( Then you don't need real numbers here - long long (int64 in Pascal) is enough to solve it |
| Test 3 crash - floating-point invalid operation | SemenB | 1209. 1, 10, 100, 1000... | 7 янв 2013 00:51 | 1 |
Please help Why am I getting floating-point invalid operation on test 3? Would it be possible to see the test values? program pr_1; var n, i, x: longint; a: real; begin read(n); for i:=1 to n do begin read(x); a:= (1 + sqrt(8*x-7))/2; if (Frac(a) = 0.0) then write('1 ') else write('0 '); end; end. |
| Please!!! what is wrong with my code. WA2????????????? | Shohruh | 1130. Никифор на прогулке | 6 янв 2013 23:48 | 1 |
program acm_1130; type vec=record x,y:longint; end; var w,a:array[1..3]of vec; c,b:vec; i,n,nn:longint; L:longint; p:array[0..10000,1..3,1..2] of byte; q:array[0..10000,1..3]of shortint; f:boolean; procedure delta(nn,r:longint); var j:longint; begin if nn=0 then exit; for j:=1 to 2 do if p[nn,r,j]>0 then begin q[nn-1,p[nn,r,j]]:=-q[nn-1,p[nn,r,j]]; delta(nn-1,p[nn,r,j]); end; end; procedure minn(i:longint); begin if sqr(a[1].x+a[2].x)+sqr(a[1].y+a[2].y)<=sqr(L) then begin w[1].x:=a[1].x+a[2].x; w[1].y:=a[1].y+a[2].y; w[2]:=a[3]; q[i,1]:=1; q[i,2]:=1; q[i,3]:=1; p[i+1,1,1]:=1; p[i+1,1,2]:=2; p[i+1,2,1]:=3; exit; end; if sqr(a[1].x-a[2].x)+sqr(a[1].y-a[2].y)<=sqr(L) then begin w[1].x:=a[1].x+a[2].x; w[1].y:=a[1].y+a[2].y; w[2]:=a[3]; q[i,1]:=1; q[i,2]:=-1; q[i,3]:=1; p[i+1,1,1]:=1; p[i+1,1,2]:=2; p[i+1,2,1]:=3; exit; end; if sqr(a[1].x+a[3].x)+sqr(a[1].y+a[3].y)<=sqr(L) then begin w[1].x:=a[1].x+a[3].x; w[1].y:=a[1].y+a[3].y; w[2]:=a[2]; q[i,1]:=1; q[i,2]:=1; q[i,3]:=1; p[i+1,1,1]:=1; p[i+1,1,2]:=3; p[i+1,2,1]:=2; exit; end; if sqr(a[1].x-a[3].x)+sqr(a[1].y-a[3].y)<=sqr(L) then begin w[1].x:=a[1].x-a[3].x; w[1].y:=a[1].y-a[3].y; w[2]:=a[2]; q[i,1]:=1; q[i,2]:=1; q[i,3]:=-1; p[i+1,1,1]:=1; p[i+1,1,2]:=3; p[i+1,2,1]:=2; exit; end; if sqr(a[2].x+a[3].x)+sqr(a[2].y+a[3].y)<=sqr(L) then begin w[1].x:=a[2].x+a[3].x; w[1].y:=a[2].y+a[3].y; w[2]:=a[2]; q[i,1]:=1; q[i,2]:=1; q[i,3]:=1; p[i+1,1,1]:=2; p[i+1,1,2]:=3; p[i+1,2,1]:=1; exit; end; if sqr(a[2].x-a[3].x)+sqr(a[2].y-a[3].y)<=sqr(L) then begin w[1].x:=a[2].x-a[3].x; w[1].y:=a[2].y-a[3].y; w[2]:=a[2]; q[i,1]:=1; q[i,2]:=1; q[i,3]:=-1; p[i+1,1,1]:=2; p[i+1,1,2]:=3; p[i+1,2,1]:=1; exit; end; end; begin read(n); read(L); if n=1 then begin write('+'); exit; end; if n=2 then begin read(c.x,c.y); read(b.x,b.y); if sqr(c.x-b.x)+sqr(c.y-b.y)<sqr(c.x+b.x)+sqr(c.y+b.y) then writeln('+-') else writeln('++'); exit; end; for i:=1 to 3 do read(a[i].x,a[i].y); fillchar(p,sizeof(p),0); fillchar(q,sizeof(q),1); minn(0); a[1]:=w[1]; a[2]:=w[2]; for i:=1 to n-3 do begin read(a[3].x,a[3].y); minn(i); a[1]:=w[1]; a[2]:=w[2]; end; f:=true; if sqr(a[1].x-a[2].x)+sqr(a[1].y-a[2].y)<sqr(a[1].x+a[2].x)+sqr(a[1].y+a[2].y) then f:=true else f:=false; if f then begin nn:=n-2; delta(nn,2); end; writeln('YES'); for i:=1 to 3 do if q[0,i]>0 then write('+') else write('-'); for i:=1 to n-3 do if q[i,3]>0 then write('+') else write('-'); end. Edited by author 07.01.2013 14:31 |
| WA 7 | TinyJanssen | 1794. Шедевры мировой архитектуры | 6 янв 2013 16:40 | 2 |
WA 7 TinyJanssen 1 янв 2013 16:42 What is special about this problem? I get WA 7 all the time. My algo [code deleted] Edited by author 01.01.2013 16:44 Edited by author 01.01.2013 20:16 Edited by author 01.01.2013 20:18 Edited by moderator 29.11.2019 14:27 I found the error, it was not the algo. It was in the routine to find the maximum. The algo is perfect. |
| This is my code in c++ .Why got WR 3 | saba_tavdgiridze | 1881. Длинное условие задачи | 6 янв 2013 14:43 | 1 |
#include<iostream> #include<string> using namespace std; int main(){ int line=1,liner,start=0,paper=1,word,symbol; cin>>liner>>symbol>>word; for(int i=0;i<word;i++){ string s; cin>>s; int a; if(start==0) a=s.size(); else a=s.size()+1; if((start+a)<symbol) start=start+a; else { start=0; line++;} } if(line%liner==0) cout<<(line/liner); else cout<<(line/liner+1); system("pause"); return 0; } |
| why the answer to the first sample is 2 I THANK IT IT 1 | Boleyn Su | 1948. Робот на прямой | 6 янв 2013 14:21 | 2 |
why the answer to the first sample is 2 I THANK IT IT 1 because let x=1 then f(x)=0 so it only takes 1 sec I misunderstood the statement. |
| WA5 | Nikiror | 1944. Досье орбитальной атаки | 6 янв 2013 12:40 | 5 |
WA5 Nikiror 5 янв 2013 14:51 Re: WA5 Andrew Sboev [USU] 5 янв 2013 15:50 For example :) 1 -5 5 Answer *....| .....| .....| .....| .....| -----+ Thank you. I pass this test and now I get WA16 (= Отослал написано Accepted, но в рейтинге стоит вопросик, хотя система засчитала правильный ответ. Так и должно быть? Re: WA5 woshipuxiaosa 6 янв 2013 12:40 |
| AV #33 | balalaeshnik | 1353. Миллиардная Функция Васи | 6 янв 2013 05:44 | 2 |
AV #33 balalaeshnik 6 янв 2013 04:51 What's wrong with 33th test?)) Or what reazons to access violation? And my IDE write correct answer - 31861500 |
| What is Test #8 input ? | kotez | 1014. Произведение цифр | 6 янв 2013 04:59 | 1 |
if N=1 000 000 000 i have Q->555555555888. And as i read it's right answer. Edited by author 06.01.2013 05:07 |
| how to get a 0.19 in the first test ? | uu_Innk | 1934. Чёрная метка | 5 янв 2013 22:01 | 4 |
how to get a 0.19 in the first test ? what formula ? |
| There is question sign in front of the assingment although system accepted my work | neeilya | | 5 янв 2013 17:56 | 1 |
What is it? Edited by author 05.01.2013 17:57 Edited by author 05.01.2013 17:57 |